Skip to main content
The native ByteSpike protocol. Speaks the Anthropic Messages API verbatim, including tool_use, cache_control, and thinking blocks. Cross-vendor models (GPT, Gemini, DeepSeek, Doubao, etc.) are transparently translated under the hood — the request you send is Anthropic-shape, regardless of which model value you pick.

When to use

Pick this endpoint when you want:
  • Anthropic SDK / Claude Code / Claude Desktop to talk to any model in our catalog
  • Tool use with the cleanest schema (no JSON-string wrapping like OpenAI’s tool_calls)
  • Prompt caching (cache_control blocks) on long static system prompts
  • Extended thinking on Opus / Sonnet 4.x
For a strict OpenAI-shape request, use /chat/completions. For Google Native, use /v1beta/models/{model}:generateContent.

Request

Headers

Body

Response

Response fields

Accounting headers

Every response — success or failure, streamed or not — carries the gateway’s quota envelope:
  • X-RateLimit-Limit / Remaining — USD budget for the rate-limit bucket closest to constraining you (5h / 1d / 7d, whichever is tightest).
  • X-RateLimit-Reset — Unix timestamp for when that bucket resets.
  • X-Quota-Remaining-Credits — lifetime credits remaining on this key (USD; 1 USD = 1,000,000 credits). Failed requests don’t move this number.
  • X-Org-Quota-Remaining-Credits — org wallet remaining, on org-owned keys.
For the actual per-request cost, query GET /api/v1/usage — it returns the prompt + completion tokens and the final billed credits per call.

Streaming

Set "stream": true. The response is SSE in the standard Anthropic format:
The full SSE event sequence — message_start → one or more (content_block_startcontent_block_delta× → content_block_stop) → message_deltamessage_stop — is identical to the Anthropic Messages spec. Tool calls arrive as tool_use content blocks streamed in chunks via input_json_delta.

Tool use (multi-turn)

Tool calling round-trips through two requests. The first carries the tool schema; the model responds with a tool_use block; you execute the tool and POST the result back in a second request.

Round 1 — tool offered

Response:

Round 2 — tool result returned

Execute get_weather({city: "Tokyo"}) locally, then send the result as a tool_result block referencing the original tool_use.id:
The model now returns a final text answer with stop_reason: "end_turn".

Image / multimodal content

Send images as image content blocks. Both base64 and URL sources work; the gateway forwards the bytes directly to vision-capable models (Claude Sonnet/Opus 4.x, GPT-5-x, Gemini, Doubao Vision, etc.).
For URL inputs:
Non-vision models reject image blocks with a 400; check the model’s capability tags via GET /v1/models.

Cross-model routing

This endpoint accepts any ByteSpike catalog model in the model field — the gateway translates the request to each model’s native protocol transparently. Pick whatever fits your latency / cost / capability mix:
Caveats:
  • Model-specific features that don’t translate (e.g. OpenAI response_format: {"type": "json_schema"}) need the matching protocol endpoint.
  • stop_reason and usage fields are normalised back to Anthropic shape regardless of the model.
Full model list: GET /v1/models. Pricing per model: bytespike.ai/pricing.

Cache control

cache_control blocks work identically to the Anthropic Messages spec. Costs are billed at the discounted cache-read rate when a hit occurs; the rate is visible in the pricing table under “cache read”.
The usage.cache_read_input_tokens and usage.cache_creation_input_tokens fields in the response report hits and writes respectively.

Rate limiting & quota headers

On a 429, inspect the x-ratelimit-reset-* header to know when to retry.

Errors

All non-2xx responses are free — failures don’t bill. Body shape: