messageChat Completions

Create a model response for a conversation. This endpoint is OpenAI-compatible, including message roles, tool calling, and streaming.

Create a chat completion

POST /v1/chat/completions

Request body

Required

  • model (string). The model ID to use.

  • messages (array). A list of messages that make up the conversation so far.

Messages

Each message has a role plus content. Supported roles include system, developer, user, assistant, tool, and function.

content can be either a simple string or a structured array for multimodal inputs. For example, user content can include typed blocks like text, image_url, input_audio, document, video_url, or file.

Basic example

curl https://proxy.alfnrl.io/v1/chat/completions \
  -H "Authorization: Bearer $ALPHANEURAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3",
    "messages": [
      { "role": "user", "content": "Write a haiku about routers." }
    ]
  }'

Multimodal example (text + image)

Multimodal content blocks are part of the message schema supported by the proxy.

Common parameters

These follow the OpenAI Chat Completions shape.

  • Sampling and length: temperature, top_p, max_tokens, stop, n, seed

  • Penalties and biasing: presence_penalty, frequency_penalty, logit_bias

  • Structured outputs: response_format

  • Logging: logprobs, top_logprobs

  • Streaming: stream, stream_options

  • Tool calling: tools, tool_choice, parallel_tool_calls

  • Legacy function calling: functions, function_call

  • Metadata: metadata, user

Tool calling

Provide tool definitions in tools. When the model decides to call a tool, it will return tool_calls on the assistant message, and you should respond by sending a tool role message referencing the matching tool_call_id.

Tool calling example

Streaming

Set stream: true to receive server-sent events (SSE). Each event contains a delta. The stream ends with a final event.

Response

The response follows the OpenAI Chat Completions format (for example, choices with an assistant message, plus token usage).

AlphaNeural proxy extensions

The proxy accepts a few optional routing and reliability fields that do not exist in the upstream OpenAI API, such as guardrails, caching, num_retries, fallbacks, and context_window_fallback_dict. Use these only if you need proxy-level behaviour controls.

Last updated