LemonData는 네이티브 Anthropic Messages API 경로를 지원하므로, Claude 모델에 대해 공식 Anthropic SDK를 직접 사용할 수 있습니다.
Anthropic SDK의 경우 base URL로 https://api.lemondata.cc를 사용하고, /v1를 직접 추가하지 마세요.
유형 : 네이티브 SDK주요 경로 : Anthropic-native지원 수준 : 강한 네이티브 경로
문서화된 SDK 경로 가운데서도 Claude-native 기능에 대해 특히 잘 지원되는 LemonData 경로 중 하나입니다.
Client 구성
from anthropic import Anthropic
client = Anthropic(
api_key = "sk-your-lemondata-key" ,
base_url = "https://api.lemondata.cc" ,
)
기본 사용법
message = client.messages.create(
model = "claude-sonnet-4-6" ,
max_tokens = 1024 ,
messages = [
{ "role" : "user" , "content" : "Explain LemonData in one sentence." }
]
)
print (message.content[ 0 ].text)
스트리밍
with client.messages.stream(
model = "claude-sonnet-4-6" ,
max_tokens = 1024 ,
messages = [{ "role" : "user" , "content" : "Write a short poem about coding." }]
) as stream:
for text in stream.text_stream:
print (text, end = "" , flush = True )
import base64
message = client.messages.create(
model = "claude-sonnet-4-6" ,
max_tokens = 1024 ,
messages = [{
"role" : "user" ,
"content" : [
{ "type" : "text" , "text" : "What's in this image?" },
{
"type" : "image" ,
"source" : {
"type" : "url" ,
"url" : "https://example.com/image.jpg"
}
}
]
}]
)
with open ( "image.png" , "rb" ) as f:
image_data = base64.b64encode(f.read()).decode()
message = client.messages.create(
model = "claude-sonnet-4-6" ,
max_tokens = 1024 ,
messages = [{
"role" : "user" ,
"content" : [
{ "type" : "text" , "text" : "Describe this image" },
{
"type" : "image" ,
"source" : {
"type" : "base64" ,
"media_type" : "image/png" ,
"data" : image_data
}
}
]
}]
)
message = client.messages.create(
model = "claude-sonnet-4-6" ,
max_tokens = 1024 ,
tools = [{
"name" : "get_weather" ,
"description" : "Get the weather for a location" ,
"input_schema" : {
"type" : "object" ,
"properties" : {
"location" : { "type" : "string" }
},
"required" : [ "location" ]
}
}],
messages = [{ "role" : "user" , "content" : "What's the weather in Tokyo?" }]
)
for block in message.content:
if block.type == "tool_use" :
print (block.name)
print (block.input)
Extended Thinking
message = client.messages.create(
model = "claude-opus-4-6" ,
max_tokens = 16000 ,
thinking = {
"type" : "enabled" ,
"budget_tokens" : 10000
},
messages = [{ "role" : "user" , "content" : "Solve this complex problem step by step." }]
)
for block in message.content:
if block.type == "thinking" :
print (block.thinking)
elif block.type == "text" :
print (block.text)
권장 Claude 모델
Model 가장 적합한 용도 claude-opus-4-6심층 추론, 장문 분석 claude-sonnet-4-6코딩, 일반적인 assistant 작업 claude-haiku-4-5빠르고 가벼운 응답
문제 해결
https://api.lemondata.cc를 사용하세요
Anthropic SDK를 구성할 때 /v1를 수동으로 추가하지 마세요
Claude 모델 이름이 정확한지 확인하세요
LemonData 모델 카탈로그에서 현재 사용 가능 여부를 확인하세요