Rivier/ Reference/ models

Ask a model through one of the project's routes

post/models/v1/chat/completions

Ask a model through one of the project's routes. The body and the answer follow the OpenAI chat completions format; model is a route name from the model list, never a model's own name. With stream: true the answer arrives as server-sent events. Uses the project's token allowance. The answer carries cost.usd, what the call cost; a stream carries it in a last piece when stream_options.include_usage is set. purpose is a short tag of your own that the day's usage is counted under.

Before you call

Credential
Authorization: Bearer $KEY
Scope
models:write
Sdk
models.completion.create
Cli
models completion create

Request bodyapplication/json, required

  • modelstringrequired
    At most 80 characters.
  • messageslist of objectrequired
    • rolestringrequired
      At most 20 characters.
  • streamboolean or null
  • ninteger or null
  • max_tokensinteger or null
  • max_completion_tokensinteger or null
  • stream_optionsobject or null
  • purposestring or null

Responses

  • 200text/event-stream
    Success

    string

  • 400application/json
    The request was malformed
    • errorstringrequired
    • messagestring
  • 401application/json
    No valid credential
    • errorstringrequired
    • messagestring
  • 403application/json
    The credential lacks the scope, origin or address
    • errorstringrequired
    • messagestring
  • 429application/json
    Over the key's rate limit; see Retry-After
    • errorstringrequired
    • messagestring

This page as Markdown