Skip to main content
    Ivy Biosciences Docs/Call the platform/API/Reference/Reference/Chat Completions/POST /v1/chat/completions

    POST /v1/chat/completions

    Create a chat completion — An OpenAI-compatible, stateless chat completion.

    Auth: required. Send an ivy_ API key (Authorization: Bearer ivy_…). See Authentication.

    An OpenAI-compatible, stateless chat completion. Your messages go straight to the model you name, with no .bloom* tools or conversation history added, so it works with OpenAI-compatible clients and evaluation frameworks. Set stream to true to receive server-sent events that end with data: [DONE]. Requires an ivy_ API key; a signed-in session token is refused.

    Request

    Request body

    modelstring

    Model id. It is matched against the available models, then routed by its name.

    messagesobject[]
    streamboolean
    max_tokensnumber
    temperaturenumber
    toolsobject[]
    tool_choiceenum ("auto" | "none" | "required") | object

    auto, none, required, or a specific function.

    Responses

    200 OK

    The completion. With stream: true the body is text/event-stream instead.

    Response shape:

    idstring
    objectenum ("chat.completion")
    createdinteger

    Unix time in seconds.

    modelstring

    The model id you sent.

    choicesobject[]
    usageobject

    400 Bad Request

    model is missing, messages is empty, or a message has no role

    Response shape: object

    401 Unauthorized

    An ivy_ API key is required

    Response shape: object

    405

    Only POST is allowed

    Response shape: object

    429 Too Many Requests

    Rate limit exceeded

    Response shape: object

    502 Bad Gateway

    The model provider call failed

    Response shape: object

    curl -X POST 'https://ivybiosciences.com/api/v1/chat/completions' \
      -H "Authorization: Bearer $IVY_API_KEY" \
      -H 'Content-Type: application/json' \
      -d '{
      "model": "",
      "messages": [
        {
          "role": "system"
        }
      ]
    }'

    Was this page helpful?

    Loading...