Skip to main content

Chat Completion

POST 

/v1/chat/completions

info

Feel free to use the Nillion2025 as a test Bearer Token

Generate a chat completion response from the AI model.

  • req: Chat completion request containing messages and model specifications
  • user: Authenticated user information (through HTTP Bearer header)
  • Returns: Full chat response with model output, usage statistics, and cryptographic signature

Request Requirements​

  • Must include non-empty list of messages
  • Must specify a model
  • Supports multiple message formats (system, user, assistant)

Response Components​

  • Model-generated text completion
  • Token usage metrics
  • Cryptographically signed response for verification

Processing Steps​

  1. Validate input request parameters
  2. Prepare messages for model processing
  3. Generate AI model response
  4. Track and update token usage
  5. Cryptographically sign the response

Potential HTTP Errors​

  • 400 Bad Request:
    • Missing messages list
    • No model specified
  • 500 Internal Server Error:
    • Model fails to generate a response

Request​

Responses​

Successful Response