Developer API

Ricochet Code API

Ricochet coding automation включает hosted model gateway, budget checks, usage reporting, premium approvals и Cloud Bridge для remote IDE control.

Budget and usage

Проверяйте ricochet_code credits, отправляйте usage и запрашивайте premium approval decisions.

МетодEndpoint
GET/ricochet/budget

Проверяет ricochet_code credits, plan, window limits, task limits и upgrade URL перед hosted AI run.

POST/ricochet/usage/report

Отправляет hosted model usage с idempotency, token counts, provider, model и billing metadata.

POST/ricochet/usage/approve-premium

Сохраняет temporary approval для premium model usage в task, run или session.

Hosted model gateway

Используйте этот Ricochet-specific chat completions endpoint для hosted coding automation со streaming support.

Пример
curl "https://grik.io/api/v1/ricochet/budget?task_id=run_123" \
  -H "Authorization: Bearer GRIK_API_KEY"

curl -X POST https://grik.io/api/v1/ricochet/openai/v1/chat/completions \
  -H "Authorization: Bearer GRIK_API_KEY" \
  -H "Idempotency-Key: run_123_turn_1" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ricochet-code",
    "messages": [
      {"role": "user", "content": "Review this repository and suggest the first safe fix."}
    ],
    "stream": true
  }'
МетодEndpoint
POST/ricochet/openai/v1/chat/completions

Запускает Ricochet hosted coding models через OpenAI-compatible chat completions gateway с streaming support.