The API, documented
with its current limits.
This reference describes the configured prototype as it exists today, including the request fields, response behaviour and boundaries that matter to an integration.
POST
/v1/chat/completions
Sends messages to the selected prototype worker and returns its OpenAI-compatible response.
/v1/chat/completionsText stream testedcurl http://localhost:3000/v1/chat/completions \
-H "Authorization: Bearer $BLASCHKE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-8b-abliterated",
"messages": [
{"role": "system", "content": "You are a concise, helpful assistant."},
{"role": "user", "content": "Explain what a Blaschke product is."}
],
"stream": true,
"stream_options": {"include_usage": true}
}'Request fields
- model
- Required. Choose
minicpm-1b-uncensoredorqwen3-8b-abliterated; another or planned alias returns 404. - messages
- 1–100 messages. Each has
role: system | user | assistant, non-empty string content (up to 100,000 characters), and an optional name up to 128 characters. - stream
- Optional boolean; defaults to false. Use true for SSE. Non-streaming JSON is preserved from the worker.
- stream_options
- Optional.
{"include_usage":true}requests terminal usage. The proxy requests upstream usage for every stream regardless of the client value. - max_tokens
- Optional integer 1–8192, subject to the selected model’s cap: 512 for MiniCPM and 2,048 for Qwen3-8B. Console defaults are 256 and 2,048 respectively.
- temperature, top_p
- Optional numbers. Temperature is 0–2; top_p is 0–1. The Console UI exposes temperature from 0 to 2 in 0.1 steps.
- stop, seed
- Optional OpenAI-style string / string-array stop (up to four) and integer seed, validated and forwarded.
- chat_template_kwargs
- Optional strict object for
enable_thinkingand low / medium / xhigh reasoning_effort. Available model-specific upstream support is not guaranteed.
Auth and model discovery
Send Authorization: Bearer $BLASCHKE_API_KEY to the direct route. A timing-safe SHA-256 digest comparison checks it against the server’s BLASCHKE_API_KEY_HASH. It is a single configured key, not a full account-key service.
GET /v1/models uses the same authorization and lists the two enabled prototype model aliases, not the planned catalogue. Upload or poll session routes are not provided by this app.
The internal POST /api/playground route accepts the selected prototype alias and forces streaming. It needs ENABLE_LOCAL_PLAYGROUND=true in development. Production requires both ALLOW_PUBLIC_PLAYGROUND=true and customer authentication to be implemented; that integration is not active yet.
Text arrives first, followed by token usage.
Events use SSE data:. The worker owns the chunks, and Blaschke forwards the bytes while observing terminal token usage.
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"delta":{"role":"assistant"},"index":0}]}
data: {"id":"chatcmpl-...","choices":[{"delta":{"content":"Finite"},"index":0}]}
# A usage-bearing final chunk; counts come from the worker
data: {"choices":[],"usage":{"prompt_tokens":18,"completion_tokens":31,"total_tokens":49}}
data: [DONE]The console retains the recent conversation, renders content deltas, and displays terminal usage. The page does not maintain a server-side conversation history. A stream can finish without visible completion text, so consumers should inspect usage and finish reasons rather than relying only on text length.
Token counts are not customer charges.
Read count fields from the terminal usage object. Calculate preview costs with the model-specific rates shown on Pricing, not a platform-wide flat fee.
{
"prompt_tokens": 18,
"completion_tokens": 31,
"total_tokens": 49
}Input token counts reported by the worker. The front end does not estimate them from characters.
Generated tokens reported by the worker. An empty or content-filtered completion may contain zero generated tokens.
The server writes completion usage to its log. It does not settle a bill or persist it into a tenant ledger. Speed metrics are not represented as measured.
A bounded interface for an early prototype.
The API validates a bounded request surface. The internal Console proxy adds stricter generation and model restrictions.
# Local prototype safeguards
temperature: 0.4 · top_p: 0.8
Console output: 256 tokens by default, max_tokens <= 512
Console history: up to four recent exchanges
/v1 max_tokens: integer 1–8192, default 512
Input: ≤100 messages, each message ≤100,000 characters
Request body: ≤1 MB; JSON Content-Type required
Default stream mode: false unless stream:true is provided
Model allowlist: qwen3-8b-abliterated only
Tool calls, images, caching, prompt guards and
customer billing are not implemented here.Credentials stay server-side. Follow the repository’s worker setup instructions, and do not expose upstream URLs or tokens in public environment variables. No UI prompt is executed as shell code.
Errors are part of the documented interface.
Blaschke validation errors use { error: { message, type, param, code } }, with the last two fields currently null. If the upstream worker returns an error, the route preserves that body and status rather than promising a cross-provider normalized code.
| Status | When | Type |
|---|---|---|
| 400 | bad request | invalid_request_error: malformed or rejected schema input |
| 401 | authentication | authentication_error: missing or mismatched key |
| 404 | unavailable model | invalid_request_error: alias is not in the enabled registry |
| 413 | oversized request | invalid_request_error — body over 1 MB |
| 415 | wrong content type | invalid_request_error — JSON required |
| 499 | client cancellation | empty response after the request was aborted |
| 502 | empty worker body | api_error: no response stream |
| 503 | configuration or connectivity | api_error: inference is not configured or reachable |
Additional errors can come directly from Modal or the active worker. Retry ordinary connectivity failures with exponential backoff and jitter where appropriate. Do not retry an invalid model alias or authentication failure unchanged.