Inference API
Create a chat completion
Generates the model's reply to a sequence of messages — with streaming, tool calls and structured output as with OpenAI.
POSThttps://api.futureway.ai/v1/chat/completions
Authentication
- Header
Authorization: Bearer $FUTUREWAY_API_KEY- Scope
- inferenceInference API: chat completions, embeddings, model list.
- Key kinds
- personal · service
- Format
- OpenAI-compatible
- Streaming
- yes — stream: true returns server-sent events
Details on keys and scopes under Authentication.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | yes | Model alias, e.g. futureway-smart. |
| messages | array | yes | The conversation in order; at least one message. |
| messages[].role | stringsystem | user | assistant | tool | yes | Who is speaking. |
| messages[].content | string | yes | Text of the message; images as content parts as with OpenAI, if the model supports images. |
| stream | boolean | no | Answer as server-sent events as tokens are generated. |
| temperature | number | no | Randomness 0–2; the model's default when omitted. |
| max_tokens | integer | no | Upper bound on the answer length. |
| tools | array | no | Tool definitions in the OpenAI function format. |
| tool_choice | string | no | auto, none or a specific tool. |
| response_format | object | no | Structured output, e.g. { "type": "json_object" }. |
Example request
curl https://api.futureway.ai/v1/chat/completions \
-H "Authorization: Bearer $FUTUREWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "futureway-smart",
"messages": [
{
"role": "user",
"content": "Was ist die Hauptstadt von Frankreich?"
}
]
}'Response
200
{
"id": "chatcmpl-8f3c…",
"object": "chat.completion",
"created": 1757750400,
"model": "futureway-smart",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Die Hauptstadt von Frankreich ist Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 9,
"total_tokens": 23
}
}Errors
| Status | Code | Description |
|---|---|---|
| 401 | unauthorized | No, invalid or revoked API key. |
| 400 | invalid_request_error | Invalid request (missing required fields, unknown parameter, body too large). |
| 404 | model_not_found | Unknown model id, or a model this key may not address. |
| 429 | rate_limit_error | Too many requests in the window; retry-after names the wait. |
| 429 | budget_exceeded | The organisation's usage quota is exhausted — no retry helps until the window resets. |
| 503 | service_unavailable | The model is temporarily unreachable — retry with backoff. |
Formats and handling under Errors.