Making your first request

Last updated: 2025-01-15
1 min read

Making Your First Request

Get started with the TaskForceAI API.

Basic Request

curl https://api.taskforceai.chat/v1/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "Hello, TaskForceAI!"}
    ]
  }'

Response

{
  "id": "chat_abc123",
  "model": "auto",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      }
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 8,
    "total_tokens": 18
  }
}

Specifying a Model

{
  "model": "claude-3-opus",
  "messages": [...]
}

Streaming

For real-time responses:

curl https://api.taskforceai.chat/v1/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [...],
    "stream": true
  }'

Still need help?

Our support team is available to assist you.

Contact Support