Langchain integration

Count tokens (LangChain - Anthropic format)

POST/langchain/anthropic/v1/messages/count_tokens

Counts tokens using Anthropic-compatible format via LangChain.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "http://localhost:8080/langchain/anthropic/v1/messages/count_tokens" \  -H "Content-Type: application/json" \  -d '{    "model": "claude-3-opus-20240229",    "max_tokens": 0,    "messages": [      {        "role": "user",        "content": "string"      }    ]  }'
{
  "input_tokens": 0
}
{
  "type": "error",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "error",
  "error": {
    "type": "string",
    "message": "string"
  }
}