POST
/
v1
/
chat
/
completions
curl --request POST \
  --url https://api.taam.cloud/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-4",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Hello, how are you today?"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 150
}'

Chat Completions API

The Chat Completions API allows you to have dynamic conversations with AI models. This endpoint enables you to send a series of messages and receive AI-generated responses that maintain context throughout the conversation.

Features

  • Support for multiple advanced AI models
  • Streaming responses for real-time applications
  • Temperature and other control parameters
  • Function calling capabilities

Example Usage

Models

Available models for chat completions:

  • wizardlm-2-7b
  • claude-3-5-sonnet
  • gpt-4o-mini

Example Request

{
  "stream": false,
  "model": "wizardlm-2-7b",
  "messages": [
    {
      "role": "user",
      "content": "What is artificial intelligence?"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 1500
}

Example With Function Calling

{
  "stream": false,
  "model": "gpt-4o-mini",
  "messages": [
    {
      "role": "user",
      "content": "What's the weather like in New York?"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_current_weather",
        "description": "Get the current weather in a given location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state"
            },
            "unit": {
              "type": "string",
              "enum": ["celsius", "fahrenheit"]
            }
          },
          "required": ["location"]
        }
      }
    }
  ]
}

Example With Image Recognition

{
  "stream": false,
  "model": "claude-3-5-sonnet",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What's in this image?"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/image.jpg",
            "detail": "auto"
          }
        }
      ]
    }
  ]
}

Authorizations

Authorization
string
header
required

Enter your API key prefixed with 'Bearer '

Body

application/json
model
string
required
messages
object[]
required
temperature
number
max_tokens
integer
stream
boolean
default:false

Whether to stream the response

Response

200

Successful response