blaschkeSign up
View Markdown

Chat Completions API

Use the Chat Completions and model-discovery endpoints, including supported fields, streaming, tools, limits, and errors.

Create a completion.

Send JSON with your API key in the bearer header. Unlisted fields are rejected.

POST /v1/chat/completions
POST https://beta.blaschkelabs.com/v1/chat/completions
Authorization: Bearer $BLASCHKE_API_KEY
Content-Type: application/json

{"model":"<model-id>","messages":[{"role":"user","content":"Explain a Blaschke product."}],"stream":false}
Accepted top-level fields
FieldAccepted formNotes
modelRequired model IDUse an available ID from GET /v1/models.
messages1–100 messagesRoles: system, user, assistant, and tool.
streamBoolean; default falseSet to true for server-sent events.
stream_optionsinclude_usage: booleanRequest a final usage event when streaming.
max_tokensInteger, 1–8192; default 512Model-specific output limits may be lower.
temperature / top_p0–2 / 0–1Optional generation controls.
stopString or up to 4 stringsOptional stop sequences.
seedIntegerDoes not guarantee reproducibility across workers.
tools1–64 function definitionsJSON parameters are supported; strict: true is not.
tool_choiceauto, none, required, or a named functionTest tool selection with your chosen model.
chat_template_kwargsModel-specific objectOnly for controls supported by the selected model and runtime.

Messages and tool history.

Return assistant tool-call messages and matching tool results together. Keep each tool_call_id and never fabricate results.

Bounded history
ItemLimit
Messages1–100
Calls per assistant message8
Tool definitions64
Call ID / function name128 characters
Function description16,384 characters
Encoded arguments32,768 characters
JSON body3,000,000 bytes
Message textModel-specific character cap

Responses and usage.

Responses follow the OpenAI Chat Completions shape. Streaming sends content and tool calls as deltas; enable stream_options.include_usage for a separate usage event.

JSON
{"id":"...","object":"chat.completion","created":0,"model":"<model-id>","choices":[{"index":0,"message":{"role":"assistant","content":"..."},"finish_reason":"stop"}],"usage":{"prompt_tokens":12,"completion_tokens":8,"total_tokens":20}}

Errors.

Read the HTTP status and the error message, type, param, and code. Generated errors currently use code: null; upstream responses may differ.

HTTP outcomes
StatusMeaning
400Invalid JSON, content type, request field, role, or output budget.
401Missing, invalid, or inactive API key.
402The available balance cannot cover the requested maximum.
404Unknown model ID or endpoint.
409An accounting update conflicted with another request.
429A budget or concurrency limit rejected the request.
502/503The inference worker failed or is unavailable.
504The inference request timed out.
JSON
{"error":{"message":"...","type":"invalid_request_error","param":null,"code":null}}