Skip to main content
POST
/
cohere
/
v2
/
chat
Error
A valid request URL is required to generate request examples
{
  "id": "<string>",
  "finish_reason": "COMPLETE",
  "message": {
    "role": "<string>",
    "content": [
      {
        "type": "text",
        "text": "<string>",
        "image_url": {
          "url": "<string>"
        },
        "thinking": "<string>",
        "document": {
          "data": {},
          "id": "<string>"
        }
      }
    ],
    "tool_calls": [
      {
        "id": "<string>",
        "type": "function",
        "function": {
          "name": "<string>",
          "arguments": "<string>"
        }
      }
    ],
    "tool_plan": "<string>"
  },
  "usage": {
    "billed_units": {
      "input_tokens": 123,
      "output_tokens": 123,
      "search_units": 123,
      "classifications": 123
    },
    "tokens": {
      "input_tokens": 123,
      "output_tokens": 123
    },
    "cached_tokens": 123
  },
  "logprobs": [
    {
      "token_ids": [
        123
      ],
      "text": "<string>",
      "logprobs": [
        123
      ]
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your provider API key or Bifrost authentication token. Virtual keys (prefixed with sk-bf-) can also be passed here.

Body

application/json
model
string
required

Model to use for chat completion

Example:

"command-r-plus"

messages
object[]
required

Array of message objects

tools
object[]
tool_choice
enum<string>

Tool choice mode - AUTO lets the model decide, NONE disables tools, REQUIRED forces tool use

Available options:
AUTO,
NONE,
REQUIRED
temperature
number
Required range: 0 <= x <= 1
p
number

Top-p sampling

k
integer

Top-k sampling

max_tokens
integer
stop_sequences
string[]
frequency_penalty
number
presence_penalty
number
stream
boolean
safety_mode
enum<string>
Available options:
CONTEXTUAL,
STRICT,
NONE
log_probs
boolean
strict_tool_choice
boolean
thinking
object
response_format
object

Response

Successful response

id
string
finish_reason
enum<string>
Available options:
COMPLETE,
STOP_SEQUENCE,
MAX_TOKENS,
TOOL_CALL,
ERROR,
TIMEOUT
message
object
usage
object
logprobs
object[]

Log probabilities (if requested)