LiteLLM Integration

Chat with model (LiteLLM - Cohere format)

Sends a chat request using Cohere-compatible format via LiteLLM.

POST
/litellm/cohere/v2/chat
AuthorizationBearer <token>

Bearer token authentication. Use your MPilot virtual-key JWT or admin JWT. Virtual keys (prefixed with sk-bf-) can also be passed here.

In: header

modelstring

Model to use for chat completion

messagesarray<CohereMessage>

Array of message objects

tools?array<object>
tool_choice?string

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

Value in"AUTO" | "NONE" | "REQUIRED"
temperature?number
Range0 <= value <= 1
p?number

Top-p sampling

k?integer

Top-k sampling

max_tokens?integer
stop_sequences?array<string>
frequency_penalty?number
presence_penalty?number
stream?boolean
safety_mode?string
Value in"CONTEXTUAL" | "STRICT" | "NONE"
log_probs?boolean
strict_tool_choice?boolean
thinking?object
response_format?object

Response Body

curl -X POST "https://loading/{AI_GATEWAY_URL}/litellm/cohere/v2/chat" \  -H "Content-Type: application/json" \  -d '{    "model": "command-r-plus",    "messages": [      {        "role": "system"      }    ]  }'
{
  "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": 0,
      "output_tokens": 0,
      "search_units": 0,
      "classifications": 0
    },
    "tokens": {
      "input_tokens": 0,
      "output_tokens": 0
    },
    "cached_tokens": 0
  },
  "logprobs": [
    {
      "token_ids": [
        0
      ],
      "text": "string",
      "logprobs": [
        0
      ]
    }
  ]
}
{
  "type": "string",
  "message": "string",
  "code": "string"
}
{
  "type": "string",
  "message": "string",
  "code": "string"
}
On this page

On this page

No Headings