POST
/
v1
/
chat
/
completions
Create chat completion
curl --request POST \
  --url https://llmadaptive.uk/api/v1/v1/chat/completions \
  --header 'Content-Type: application/json' \
  --header 'X-Stainless-API-Key: <api-key>' \
  --data '{
  "messages": [
    {
      "role": "system",
      "content": "<string>",
      "name": "<string>",
      "tool_calls": [
        {
          "id": "<string>",
          "type": "function",
          "function": {
            "name": "<string>",
            "arguments": "<string>"
          }
        }
      ],
      "tool_call_id": "<string>"
    }
  ],
  "model": "adaptive",
  "stream": false,
  "temperature": 0.7,
  "max_tokens": 1000,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "n": 1,
  "stop": "<string>",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "<string>",
        "description": "<string>",
        "parameters": {}
      }
    }
  ],
  "tool_choice": "none",
  "user": "<string>",
  "provider_constraint": [
    "openai",
    "anthropic"
  ],
  "cost_bias": 0.3
}'
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "gpt-4o",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "system",
        "content": "<string>",
        "name": "<string>",
        "tool_calls": [
          {
            "id": "<string>",
            "type": "function",
            "function": {
              "name": "<string>",
              "arguments": "<string>"
            }
          }
        ],
        "tool_call_id": "<string>"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "cost_saved": 0.35
  },
  "system_fingerprint": "<string>",
  "provider": "openai"
}

Authorizations

X-Stainless-API-Key
string
header
required

API key for authentication. Obtain from your Adaptive dashboard. Must have active billing or available free credits.

Body

application/json

Chat completion request with OpenAI-compatible parameters and Adaptive extensions

The body is of type object.

Response

200
application/json

Chat completion response

The response is of type object.