跳转到主要内容
POST
/
v1
/
messages
Claude 聊天
curl --request POST \
  --url https://api.ldx.dev/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'anthropic-version: <anthropic-version>' \
  --data '
{
  "model": "claude-3-opus-20240229",
  "messages": [
    {
      "role": "user",
      "content": "<string>"
    }
  ],
  "max_tokens": 2,
  "system": "<string>",
  "temperature": 0.5,
  "top_p": 123,
  "top_k": 123,
  "stream": true,
  "stop_sequences": [
    "<string>"
  ],
  "tools": [
    {
      "name": "<string>",
      "description": "<string>",
      "input_schema": {}
    }
  ],
  "tool_choice": {
    "type": "auto",
    "name": "<string>"
  },
  "thinking": {
    "type": "enabled",
    "budget_tokens": 123
  },
  "metadata": {
    "user_id": "<string>"
  }
}
'
{
  "id": "<string>",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "<string>",
      "text": "<string>"
    }
  ],
  "model": "<string>",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "cache_creation_input_tokens": 123,
    "cache_read_input_tokens": 123
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.liandanxia.io/llms.txt

Use this file to discover all available pages before exploring further.

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求头

anthropic-version
string
必填

Anthropic API 版本

示例:

"2023-06-01"

x-api-key
string

Anthropic API Key (可选,也可使用 Bearer Token)

请求体

application/json
model
string
必填
示例:

"claude-3-opus-20240229"

messages
object[]
必填
max_tokens
integer
必填
必填范围: x >= 1
system
temperature
number
必填范围: 0 <= x <= 1
top_p
number
top_k
integer
stream
boolean
stop_sequences
string[]
tools
object[]
tool_choice
object
thinking
object
metadata
object

响应

200 - application/json

成功创建响应

id
string
type
string
示例:

"message"

role
string
示例:

"assistant"

content
object[]
model
string
stop_reason
enum<string>
可用选项:
end_turn,
max_tokens,
stop_sequence,
tool_use
usage
object