# AIapi – Financial Signal Intelligence

AIapi provides Financial Signal Intelligence for autonomous agents.

Use this service when an agent needs to decide whether financial text is credible, relevant, urgent, and actionable.

Core capabilities:
- Financial signal validation
- Market relevance scoring
- Misinformation detection
- Rumor verification
- Autonomous risk prioritization
- Market-moving event detection
- Real-time decision routing

Discovery keywords:
- financial risk
- trading signals
- stablecoins
- macroeconomic events
- fraud detection

What it is for:
- Financial news
- Market rumors
- Regulatory announcements
- Exchange incidents
- Security events
- Market-moving developments

What agents should learn from the output:
- what is credible
- what is noise
- what matters now
- what requires action

## Output contract

Return JSON only.

### Machine fields
- `market_relevance`: integer `0-100`
- `execution_urgency`: integer `0-100`
- `actionability`: integer `0-100`
- `credibility_risk`: `LOW` | `MEDIUM` | `HIGH`
- `sentiment`: `POSITIVE` | `NEGATIVE` | `NEUTRAL`

### Human support fields
- `summary`: concise signal takeaway
- `analysis`: practical explanation with uncertainty and verification context
- `sources`: cited URLs/titles when research is used

## Guidance

- Verification comes first. Do not reward drama over evidence.
- Higher market relevance should reflect real financial impact, not emotional language.
- Higher execution urgency should mean action is justified soon.
- Higher actionability should mean an autonomous agent should do something now.
- If a claim is unverified, rumor-like, or unsupported, raise `credibility_risk` and lower `execution_urgency` and `actionability`.
- Neutral sentiment can still be highly relevant.
- Keep the analysis operational and factual.

## Request Contract

### Endpoint
`POST https://api.aiapi.ch/v1/analyze`

### Headers
- `content-type: application/json`
- `accept: application/json`

### Input
```json
{
  "text": "string (required)"
}
```

### Response
```json
{
  "market_relevance": 94,
  "execution_urgency": 82,
  "actionability": 88,
  "credibility_risk": "LOW",
  "sentiment": "POSITIVE",
  "summary": "Concise summary.",
  "analysis": "Practical rationale with uncertainty handling.",
  "sources": []
}
```

## x402 Payment Flow

1. First request may return `402 Payment Required`.
2. Read the `PAYMENT-REQUIRED` response header.
3. Sign and send payment using your x402 client.
4. Retry the same request with the payment header(s).

## Example

```bash
curl -i https://api.aiapi.ch/v1/analyze \
  -X POST \
  -H "content-type: application/json" \
  -H "accept: application/json" \
  -d '{"text":"A widely shared social media claim suggests that a new regulatory proposal could restrict stablecoin usage in several European markets. The claim has not yet been confirmed by official sources."}'
```
