# anyllm.space API — LLM & Coding Agent Integration Guide (llms.txt) > Unified AI API gateway billed in RUB (Russian Rubles) for developers, studios, and automation workflows (OpenAI-style text, Anthropic Messages text, and speech synthesis). > Base URL: https://api.anyllm.space/v1 > Auth: `Authorization: Bearer $ANYLLM_API_KEY` (or `x-api-key` for Anthropic `/v1/messages`) > Support: Telegram @anyllm_support · Email hello@anyllm.space Non-streaming text responses with an idempotency key may be replayed from process memory for up to 60 seconds. A missing cached body returns 409 with no second charge. Streaming responses and audio are not replayed. Missing or invalid usage returns 502 upstream_usage_unavailable and releases the reserve. Text and speech share key and project budgets. ## Quick Rules for AI Agents 1. NEVER hardcode API keys in source code. Always read `ANYLLM_API_KEY` from environment variables. 2. ALWAYS pass `Idempotency-Key` on billable requests to prevent duplicate charges on retries or timeouts. 3. ALWAYS pass `X-Max-Cost-Rub` on unattended loops or user-triggered workflows. If the upper estimate exceeds the cap, anyllm.space rejects with `HTTP 422 max_cost_exceeded` BEFORE calling the upstream provider (0 RUB charged). 4. Pass `X-Client-Reference` (max 128 chars, no PII) to tag requests by client/order/SKU for UTF-8 BOM CSV reconciliation. 5. On `5xx` or network timeout, DO NOT blind-retry with a new `Idempotency-Key`. Check final state via `GET /v1/requests/{id}` or retry with the SAME `Idempotency-Key`. Unsettled reserves auto-release after 24 hours. ## Documentation & Key Pages - Overview & Agent Prompt: https://anyllm.space/docs - Quickstart (cURL / Python / TS): https://anyllm.space/docs/quickstart - Clients (Claude Code, Cursor, Cline, Codex, n8n, Make): https://anyllm.space/docs/clients - Chat & Anthropic Messages API: https://anyllm.space/docs/api-chat-messages - Speech synthesis and media availability: https://anyllm.space/docs/api-audio-media - Cost Caps, Quotes & Idempotency: https://anyllm.space/docs/cost-caps-idempotency - Error Codes & Retryability Matrix: https://anyllm.space/docs/errors - Billing and availability of business documents: https://anyllm.space/docs/billing-edo - RUB Cost Calculator: https://anyllm.space/calculator - Gateway and database health: https://anyllm.space/status - Competitor Comparison (vs ProxyAPI / 1APP / OpenRouter): https://anyllm.space/compare - About & Legal Entity: https://anyllm.space/about ## Core Endpoints - `POST https://api.anyllm.space/v1/chat/completions` — OpenAI-compatible text/code - `POST https://api.anyllm.space/v1/messages` — Anthropic-style text and text blocks. Tool calls, cache_control and streaming are unsupported. - `POST https://api.anyllm.space/v1/audio/speech` — ElevenLabs Russian TTS (returns MP3 + `X-Request-Id`) - `POST https://api.anyllm.space/v1/quotes` — Pre-dispatch RUB reserve quote (5-min TTL, pass `X-Quote-Id`) - `GET https://api.anyllm.space/v1/requests/{id}` — Separate `execution_status` & `billing_status` + RUB breakdown - `GET https://api.anyllm.space/v1/balance` — Available and reserved RUB balance of the organization (balance_scope=organization) ## Current models and RUB pricing - GET https://api.anyllm.space/catalog/models returns the current active price versions, units, model endpoints and provider configuration status. No key is required. A configured provider is not a live health measurement. - GET https://api.anyllm.space/v1/models returns the same rates with a project key. For text, rates are in RUB per million tokens. For speech, rates are in RUB per million characters. - Use demo-text for a free deterministic test. Public image and video job routes are not implemented. - Chat stream:true returns buffered SSE events after the provider finishes. Messages supports text or text blocks. Unsupported request parameters receive HTTP 400 unsupported_parameter. - Tested on a local gateway on 2026-12-03: cURL 8.7.1 performed a text request. Codex CLI 0.153.4 requires Responses API. Claude Code 2.1.191 sent unsupported cache_control even with tools disabled. ## Error Codes - `400` invalid_request — malformed JSON/params - `401` invalid_api_key — missing or revoked key - `402` insufficient_balance — not enough available RUB for reserve - `403` budget_exceeded — project/key daily (00:00 MSK) or monthly limit hit - `404` not_found — invalid model or cross-project resource ID - `409` idempotency_conflict / request_in_progress / stream_not_replayable / result_not_retained / quote_expired / quote_mismatch - `413` payload_too_large — request body exceeds limit - `422` max_cost_exceeded — estimate exceeds `X-Max-Cost-Rub` (0 RUB charged) - `429` rate_limit_exceeded — respect `Retry-After` - `502`/`503`/`504` upstream_error — inspect `GET /v1/requests/{id}` before retrying