Skip to main content
POST
/
api
/
v1
/
chat
curl -X POST "https://api.deeptrace.com/api/v1/chat" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your_api_key>" \
  -d '{
    "messages": [
      {"role": "user", "content": "What errors are happening in production right now?"}
    ]
  }'
{
  "chat_id": "baa1b1be-4905-4448-9a37-159f08dfc570",
  "response": "Let me check your error tracking tools...",
  "usage": {
    "input_tokens": 3,
    "output_tokens": 624,
    "cache_creation_input_tokens": 92161,
    "cache_read_input_tokens": 0,
    "cost": 0.59,
    "model": "claude-opus-4-6",
    "api_calls_count": 1
  }
}
Send a message and receive an AI-powered response. Supports multi-turn conversations by passing a chat_id from a previous response.

Headers

Authorization
string
required
Bearer token with your Deeptrace API key. Format: Bearer <your_api_key>.

Query Parameters

stream
boolean
default:"false"
Enable Server-Sent Events streaming.

Body

messages
object[]
required
Array of message objects (minimum 1).
chat_id
string
ID of an existing chat to continue a conversation.
model
string
default:"claude-opus-4-6"
Model to use for the response.
system_prompt
string
Custom system prompt override.
curl -X POST "https://api.deeptrace.com/api/v1/chat" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your_api_key>" \
  -d '{
    "messages": [
      {"role": "user", "content": "What errors are happening in production right now?"}
    ]
  }'

Returns

Returns the chat ID and the assistant’s response along with usage information.
{
  "chat_id": "baa1b1be-4905-4448-9a37-159f08dfc570",
  "response": "Let me check your error tracking tools...",
  "usage": {
    "input_tokens": 3,
    "output_tokens": 624,
    "cache_creation_input_tokens": 92161,
    "cache_read_input_tokens": 0,
    "cost": 0.59,
    "model": "claude-opus-4-6",
    "api_calls_count": 1
  }
}
chat_id
string
required
UUID of the chat. Use this to continue the conversation or retrieve the chat later.
response
string
required
The assistant’s response text.
usage
object
required
Token usage and cost information for the request.

Continuing a Conversation

Pass the chat_id from a previous response to continue the conversation:
curl -X POST "https://api.deeptrace.com/api/v1/chat" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your_api_key>" \
  -d '{
    "chat_id": "baa1b1be-4905-4448-9a37-159f08dfc570",
    "messages": [
      {"role": "user", "content": "Can you dig deeper into the top error?"}
    ]
  }'

Streaming

Add ?stream=true to receive Server-Sent Events:
curl -X POST "https://api.deeptrace.com/api/v1/chat?stream=true" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your_api_key>" \
  -d '{
    "messages": [
      {"role": "user", "content": "What errors are happening in production?"}
    ]
  }'
Stream event types:
Event TypeDescription
startStream initiated, includes messageId and chatId
reasoning-startBeginning of reasoning block
reasoning-deltaIncremental reasoning text
reasoning-endEnd of reasoning block
text-startBeginning of response text
text-deltaIncremental response text
text-endEnd of response text