API compatibility
This page lists what Spark's OpenAI and Anthropic compatible routes read and what they refuse. Anything not listed is ignored without an error.
OpenAI routes
| Route | Supported |
|---|---|
GET /v1/models |
Yes. Lists ids and aliases, owned_by: "spark". On a central, the nodes' models too. |
POST /v1/chat/completions |
Yes. See below. |
POST /v1/completions |
Yes. prompt as a string or a one element array. |
POST /v1/embeddings |
Yes. For bert, nomic-bert and gemma-embedding2 models. |
POST /v1/responses |
No. |
| Audio, images, files, batches, fine-tuning, moderation | No. |
Chat completions parameters
| Parameter | Behavior |
|---|---|
model |
Required unless a default model exists. Matches an id, an alias or a file name, ignoring case. |
messages |
Required, non-empty. Roles system, developer (as system), user, assistant and tool. Fields read: content, name, tool_call_id, tool_calls, reasoning_content, reasoning. |
| Content parts | text and input_text, image_url and input_image. input_audio and file are refused with 400. |
stream, stream_options.include_usage |
Yes. Ends with data: [DONE]. |
max_completion_tokens, max_tokens |
Yes. Must be positive. |
temperature, top_p, top_k, min_p |
Yes. |
presence_penalty, frequency_penalty |
Yes. |
repetition_penalty, repeat_penalty |
Yes, as extensions. |
seed |
Yes. |
stop |
Yes. A string or an array. |
n |
Only 1. Other values give 400. |
tools |
Yes. Function tools, in {"type": "function", "function": {...}} form or flat. Each needs a name. |
tool_choice |
Only "none" is read. Other values are ignored. |
response_format |
json_object and json_schema. |
reasoning_effort, think, chat_template_kwargs.enable_thinking, reasoning.effort |
Turn thinking on. |
prompt_cache_key |
Read as a cache key. |
logprobs, top_logprobs |
Ignored. logprobs is always null in the response. |
user, metadata, store and others |
Ignored. |
Completions parameters
The sampling parameters above, plus prompt (required) and max_tokens (default 16). Token arrays and batches are refused. n must be 1.
Embeddings parameters
| Parameter | Behavior |
|---|---|
model |
An embedding model. A chat model gives 400. |
input |
A string, or a non-empty array of strings. Token arrays are refused. |
encoding_format |
float (default) or base64. Anything else gives 400. |
dimensions |
Truncates and normalizes again. More than the model has gives 400. |
On a central, a model that only a node has does not answer embeddings: 501.
Response fields
usage has prompt_tokens, completion_tokens, total_tokens and prompt_tokens_details.cached_tokens. Reasoning comes as reasoning_content. The x-request-id header names the request in the request log.
Anthropic routes
| Route | Supported |
|---|---|
POST /v1/messages |
Yes. See below. |
POST /v1/messages/count_tokens |
Yes. Returns input_tokens. |
| Message batches, the Files API, the models list | No. |
Messages parameters
| Parameter | Behavior |
|---|---|
model |
As for OpenAI. |
max_tokens |
Required. 400 without it. |
messages |
Required, non-empty. content as a string or an array of blocks. |
system |
A string, or an array of text blocks. |
| Blocks | text, image (base64 or url source), thinking, redacted_thinking (ignored), tool_use, tool_result. document is refused with 400. |
stream |
Yes. Typed events. |
temperature, top_p, top_k |
Yes. |
stop_sequences |
Yes. |
tools |
Tools with an input_schema. Server tools without a schema are skipped. |
tool_choice |
Only {"type": "none"} is read. |
thinking |
type of enabled or adaptive turns thinking on. |
cache_control |
On blocks, on system, on tools, or at the top level. Writes a KV snapshot at the breakpoint. |
metadata, service_tier, mcp_servers and others |
Ignored. |
Messages response fields
stop_reason is end_turn, max_tokens, stop_sequence or tool_use. usage has input_tokens, cache_read_input_tokens, cache_creation_input_tokens and output_tokens. A thinking block has an empty signature.
Authentication and errors
| Case | OpenAI routes | Anthropic routes |
|---|---|---|
| Key sent as | Authorization: Bearer or x-api-key |
x-api-key or Authorization: Bearer |
| No or wrong key | 401, invalid_request_error |
401, authentication_error |
| Unknown model | 404, not_found_error |
404, not_found_error |
| Invalid request | 400, invalid_request_error |
400, invalid_request_error |
| Generation failed | 500, api_error |
500, api_error |
Known gaps
- No continuous batching. Requests to one model run one at a time.
- No
nabove 1 and nologprobs. - No Responses API.
- No audio input, and no image or video generation.
- No per-key rate limits, quotas or model allow lists.
- No context shifting. A prompt that exceeds the context is refused.