POST
/
openai
/
v1
/
chat
/
completions
curl --request POST \
  --url https://api.groq.com/openai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "frequency_penalty": 0,
  "function_call": "none",
  "functions": [
    {
      "description": "<string>",
      "name": "<string>",
      "parameters": {}
    }
  ],
  "logit_bias": null,
  "logprobs": false,
  "max_tokens": 123,
  "messages": [
    {
      "content": "<string>",
      "name": "<string>",
      "role": "system",
      "tool_call_id": "<string>"
    }
  ],
  "model": "<string>",
  "n": 1,
  "parallel_tool_calls": true,
  "presence_penalty": 0,
  "response_format": {
    "type": "json_object"
  },
  "seed": 123,
  "stop": "\n",
  "stream": false,
  "stream_options": null,
  "temperature": 1,
  "tool_choice": "none",
  "tools": [
    {
      "function": {
        "description": "<string>",
        "name": "<string>",
        "parameters": {}
      },
      "type": "function"
    }
  ],
  "top_logprobs": 10,
  "top_p": 1,
  "user": "<string>"
}'
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 123,
      "logprobs": {
        "content": [
          {
            "bytes": [
              123
            ],
            "logprob": 123,
            "token": "<string>",
            "top_logprobs": [
              {
                "bytes": [
                  123
                ],
                "logprob": 123,
                "token": "<string>"
              }
            ]
          }
        ]
      },
      "message": {
        "content": "<string>",
        "function_call": {
          "arguments": "<string>",
          "name": "<string>"
        },
        "role": "assistant",
        "tool_calls": [
          {
            "function": {
              "arguments": "<string>",
              "name": "<string>"
            },
            "id": "<string>",
            "type": "function"
          }
        ]
      }
    }
  ],
  "created": 123,
  "id": "<string>",
  "model": "<string>",
  "object": "chat.completion",
  "system_fingerprint": "<string>",
  "usage": {
    "completion_time": 123,
    "completion_tokens": 123,
    "prompt_time": 123,
    "prompt_tokens": 123,
    "queue_time": 123,
    "total_time": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

The chat prompt and parameters

The body is of type object.

Response

200 - application/json

OK

Represents a chat completion response returned by model, based on the provided input.