API reference
Chat completions
Send a conversation, get the model's next message. Same request and response shape as the OpenAI Chat Completions API.
POST https://www.synaps.chat/api/v1/chat/completionsRequest body
modelstringrequireddeepseek/deepseek-chat. Must be one of the IDs returned by GET /models. Free models end in :free.messagesarrayrequiredrole (system, user, assistant or tool) and content. Assistant messages may carry tool_calls; tool messages carry tool_call_id.streambooleanmax_tokensinteger4096 when omitted. Lower it to cap the cost of a single request.temperaturenumbertop_pnumbertemperature, not both.stopstring | string[]frequency_penaltynumberpresence_penaltynumberseedintegertoolsarraytool_choicestring | objectauto, none, required, or a specific function.response_formatobject{ "type": "json_object" } or a JSON schema, on models that support structured output. See JSON output.reasoningobject{ "effort": "high" }. Ignored by models that do not reason.Example request
curl https://www.synaps.chat/api/v1/chat/completions \
-H "Authorization: Bearer $SYNAPS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-chat",
"temperature": 0.3,
"max_tokens": 300,
"messages": [
{"role": "system", "content": "Answer in one short paragraph."},
{"role": "user", "content": "Why do tokens use bonding curves?"}
]
}'Response
{
"id": "gen-1729760000-AbCdEf",
"object": "chat.completion",
"created": 1729760000,
"model": "deepseek/deepseek-chat",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "A bonding curve sets the price from the supply..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 31,
"completion_tokens": 74,
"total_tokens": 105,
"cost": 0.000123
}
}choices[].message.contentstring | nullnull when the model answered only with tool calls.choices[].message.tool_callsarraychoices[].finish_reasonstringstop (finished), length (hit max_tokens), tool_calls, or content_filter.usage.prompt_tokensintegerusage.completion_tokensintegerusage.costnumber0 for free models.Multi-turn conversations
The API is stateless. To continue a conversation, send the full history every time, including the assistant's previous replies:
history = [{"role": "user", "content": "Name a layer-2 chain."}]
first = client.chat.completions.create(model="deepseek/deepseek-chat", messages=history)
history.append({"role": "assistant", "content": first.choices[0].message.content})
history.append({"role": "user", "content": "Who runs it?"})
second = client.chat.completions.create(model="deepseek/deepseek-chat", messages=history)Images
Models with vision accept image parts in a user message, using the OpenAI content-array format:
{
"role": "user",
"content": [
{ "type": "text", "text": "What is in this chart?" },
{ "type": "image_url", "image_url": { "url": "https://example.com/chart.png" } }
]
}You can also send an image as a base64 data URL (data:image/png;base64,…). PNG, JPEG, WebP and GIF are accepted. Only models that list image in input_modalities on GET /models can read images; sending one to a text-only model returns an error.
PDFs and documents
Send a PDF as a file part with a base64 data URL. It works with every model: models that read files natively get the PDF as is, and the rest receive its extracted text.
{
"role": "user",
"content": [
{ "type": "text", "text": "Summarise the key terms in this contract." },
{ "type": "file", "file": { "filename": "contract.pdf", "file_data": "data:application/pdf;base64,JVBERi0x..." } }
]
}For plain text, Markdown, CSV, JSON or code files, put the contents straight into the text of the message. That is cheaper and works with any model.
Generating images
Models that list image in output_modalities can create images. Add "modalities": ["image", "text"] and send the request without streaming:
{
"model": "google/gemini-3.1-flash-image",
"modalities": ["image", "text"],
"messages": [{ "role": "user", "content": "A glass orb orbiting a violet planet, studio lighting" }]
}The images come back on the assistant message as base64 data URLs:
{
"choices": [{
"message": {
"role": "assistant",
"content": "Here is your image.",
"images": [{ "type": "image_url", "image_url": { "url": "data:image/png;base64,iVBORw0..." } }]
}
}],
"usage": { "prompt_tokens": 14, "completion_tokens": 1290, "cost": 0.0468 }
}You pay what the model charges for the image plus the usual 20% fee, shown in usage.cost. Model IDs change over time, so pick a current one from GET /models.