POST
/
{workspace}
/
{project}
/
{prompt}
/
{environment}
curl --request POST \
  --url https://api.langtail.com/{workspace}/{project}/{prompt}/{environment} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <x-api-key>' \
  --data '{
  "variables": {
    "variableName": "Your Value"
  },
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "stream": false,
  "model": "<string>",
  "max_tokens": 123,
  "temperature": 123,
  "top_p": 123,
  "presence_penalty": 123,
  "frequency_penalty": 123,
  "template": [
    {
      "role": "assistant",
      "name": "<string>",
      "content": "<string>",
      "function_call": {
        "name": "<string>",
        "arguments": "<string>"
      },
      "tool_calls": [
        {
          "id": "<string>",
          "type": "function",
          "function": {
            "name": "<string>",
            "arguments": "<string>"
          }
        }
      ],
      "tool_choice": "auto",
      "tool_call_id": "<string>"
    }
  ],
  "tool_choice": "auto",
  "response_format": {
    "type": "json_object"
  },
  "user": "user_123",
  "doNotRecord": false,
  "metadata": {
    "my_identifier": "my-custom-ID"
  },
  "seed": 123
}'
{
  "id": "<string>",
  "object": "<string>",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I'm sorry, but I'm not able to fulfill this request."
      },
      "finish_reason": "stop"
    }
  ]
}

Headers

X-API-Key
string
required

Your Langtail API Key

Example:

"<LANGTAIL_API_KEY>"

Path Parameters

workspace
string
required

Your workspace URL slug

Example:

"workspace"

project
string
required

Your project URL slug

Example:

"project"

prompt
string
required

Your prompt URL slug

Example:

"prompt"

environment
string
required

Your environment URL slug

Example:

"production"

Body

application/json

Response

200
application/json
Chat completion response from OpenAI - see https://platform.openai.com/docs/api-reference/chat/object for more details.

The response is of type object.