30 lines
900 B
Python
30 lines
900 B
Python
# -*- coding: utf-8 -*-
|
|
import anthropic
|
|
|
|
client = anthropic.Anthropic(
|
|
api_key="sk-cp-KfOUZiipk1SYliv6n5faaXQXIxRum6jiRdAF_aGiYeCSp12p4amSU94rPAvEp4ZgRAS7d8bwR7rruuGVqVCo9ZysSOewR0xPEOZ_XCPJEBhcqt5vrUWu4ls", # <--- 在这里填入你的 MiniMax 密钥
|
|
base_url="https://api.minimaxi.com/anthropic" # <--- MiniMax 的兼容接口地址
|
|
)
|
|
|
|
message = client.messages.create(
|
|
model="MiniMax-M2.5",
|
|
max_tokens=1000,
|
|
system="You are a helpful assistant.",
|
|
messages=[
|
|
{
|
|
"role": "user",
|
|
"content": [
|
|
{
|
|
"type": "text",
|
|
"text": "你现在使用的是什么模型"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
)
|
|
|
|
for block in message.content:
|
|
if block.type == "thinking":
|
|
print(f"Thinking:\n{block.thinking}\n")
|
|
elif block.type == "text":
|
|
print(f"Text:\n{block.text}\n") |