Skip to content
Back to skills

Chutes Call

ASecurity

Centralized Chutes.ai LLM gateway as a shared Docker service. Global 5-slot semaphore enforces account concurrency limit across all agents. Single and batch calls with tenacious retry mode, circuit breaker, fallback chain, NDJSON streaming, and structured request/response objects with JSON cleaning.

  • 6 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 11, 2026
devopsbashfastapidockerapibackendsecurity

Works with

  • api

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add grahama1970/agent-skills --skill chutes-call --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Chutes Call?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Chutes Call
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/grahama1970-chutes-call/badge)](https://www.skillsdirectory.com/skills/grahama1970-chutes-call)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: chutes-call
description: >
  Centralized Chutes.ai LLM gateway as a shared Docker service. Global 5-slot
  semaphore enforces account concurrency limit across all agents. Single and
  batch calls with tenacious retry mode, circuit breaker, fallback chain, NDJSON
  streaming, and structured request/response objects with JSON cleaning.
triggers:
  - chutes call
  - chutes api
  - chutes gateway
  - llm call
  - llm gateway
  - chutes completion
  - chutes batch
  - tenacious call
  - chutes retry
  - chutes circuit breaker
  - cheap llm
  - deepseek call
allowed-tools:
  - Bash
  - Docker
metadata:
  short-description: Shared Docker LLM gateway with global concurrency control for Chutes.ai
provides:
  - llm-completion
  - llm-batch
  - chutes-gateway
  - json-cleaning
composes:
  - ops-chutes
  - rate-limit-recovery
  - service-status
  - agentic-evals
taxonomy:
  - infrastructure
  - llm-completion
disciplines:
  - model-ops
---

# chutes-call

Shared Docker FastAPI service (port 8630) that centralizes ALL Chutes.ai LLM
calls. Enforces the account-wide 5-concurrent-connection limit via a global
asyncio semaphore, handles retries with tenacity, implements a circuit breaker
(CLOSED/OPEN/HALF-OPEN), and returns structured request/response objects with
cleaned JSON.

## Why

- Chutes has a hard 5-concurrent-connection limit per account.
- Without centralized coordination, multiple agents cause ~50% failure rate.
- scillm's retry logic has shared mutable state bugs and 30s timeouts.
- 31 skills make bespoke Chutes calls — one gateway replaces all of them.

## Usage

```bash
# Start the gateway
./run.sh start

# Check health + circuit states
./run.sh health

# Stop
./run.sh stop

# View logs
./run.sh logs
```

## API

### POST /chat (single call)

```bash
curl -X POST http://localhost:8630/chat \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "What is 2+2?"}]}'
```

Response:
```json
{
  "ok": true,
  "content": "2+2 = 4",
  "json_content": null,
  "raw_content": "2+2 = 4",
  "model": "deepseek-ai/DeepSeek-V3",
  "backend": "chutes",
  "retries": 0,
  "elapsed_s": 1.2,
  "tokens_in": 12,
  "tokens_out": 8,
  "cost_usd": 0.001,
  "error": null,
  "circuit_state": "CLOSED"
}
```

### POST /batch (batch calls, NDJSON streaming)

```bash
curl -N -X POST http://localhost:8630/batch \
  -H "Content-Type: application/json" \
  -d '{
    "requests": [
      {"messages": [{"role": "user", "content": "Hello"}]},
      {"messages": [{"role": "user", "content": "World"}]}
    ],
    "tenacious": true,
    "stream": true
  }'
```

Each line is a JSON object:
```
{"index": 0, "ok": true, "content": "Hi!", "backend": "chutes", "elapsed_s": 1.1}
{"index": 1, "ok": true, "content": "World!", "backend": "chutes", "elapsed_s": 0.9}
{"summary": {"total": 2, "ok": 2, "errors": 0, "retries": 0, "cost_usd": 0.002}}
```

### GET /health

Returns service health, backend availability, and circuit breaker states.

### GET /queue

Live dashboard: active calls, queue depth, error rates, cost/min, per-caller stats.

### GET /usage / DELETE /usage

Accumulated cost/token stats since container start. DELETE resets counters.

## Tenacious Mode

Two operating modes controlled by the `tenacious` field:

| Mode | Retries | Backoff | Timeout | Fallback |
|------|---------|---------|---------|----------|
| Normal (`false`) | 1 | 2s fixed | 60s | None |
| Tenacious (`true`) | 5 | 2s→60s exponential+jitter | 60→120→180s escalating | OpenRouter → Gemini Flash |

## Circuit Breaker

Per-backend state machine:
- **CLOSED**: Normal operation. 3 consecutive failures → trip to OPEN.
- **OPEN**: All requests fail immediately (no network call). After 60s → HALF-OPEN.
- **HALF-OPEN**: 1 probe request. Success → CLOSED. Failure → OPEN.

## Architecture

```
Callers (any process/container)        Docker: embry-chutes-call :8630
  host processes, subagents,     →     Global Semaphore (5 slots)
  scillm, any skill              →     Tenacity retries + backoff
                                 →     Circuit breaker per backend
                                 →     Fallback chain
                                 →     JSON cleaning
                                 →     Cost tracking + dashboard
                                        ↓
                                 Chutes API (primary)
                                 OpenRouter (fallback 1)
                                 Gemini Flash (fallback 2)
```

## Security

- API keys mounted from host env (not baked into image).
- Container runs as non-root user.
- Host network mode for consistency with Embry services.

Files in this skill

  • Dockerfile331 B
  • SKILL.md4.6 KB
  • _misuse_guard.py10.5 KB
  • backends.yml1.1 KB
  • client.py5.9 KB
  • docker-compose.yml989 B
  • fixtures/agentic_eval.json489 B
  • policy.yaml1.5 KB
  • requirements.txt101 B
  • run.sh4.1 KB
  • sanity.sh2 KB
  • server.py22.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.