Home Forums Investment Road to FinGPT #4 Road to FinGPT #4 Name * Password * Email <strong>Anthropic의 Claude 3 Opus를 pay-as-you-go로 결제하고 주가 물어보기</strong> <ol> <li>비용: 1M 토큰 당, opus 15불, sonnet 3불, haiku 0.25불이라고 한다. <li>웹 https://claude.ai/chat/ 이 현재 claude-3-sonnet 모델을 사용 중이고, 무료이다. <li>api로는 제일 비싼 모델 claude-3-opus만 액세스 가능했는데, 8k 입력 호출 당 8센트 과금이 되었다. <li>코드는 <pre> import anthropic client = anthropic.Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"), ) message = client.messages.create( model="claude-3-opus-20240229", max_tokens=1000, temperature=0.0, system="You are a seasoned stock market analyst.", messages=[ {"role": "user", "content": prompt} ] ) response_str = message.content[0].text </pre> <li>이렇게 해주면 제일 비싼 모델 claude-3-opus-20240229를 호출한다. 콜당 8센트. opus 보다 1/5 비용인 sonnet을 사용해보려고했는데 에러가 나서 안 됐고, opus의 1/60 비용인 haiku를 써보려고 했는데 그것도 에러가 나서 안 됐음. <li> 더 싼 모델 가운데 동작하는 건 claude-1.3. 가격은 콜당 2센트. <li>역시 response_str에 저장된 json 데이터를 잘 잘라서 파일에 저장해주면 된다. </ol> I agree to the terms of service Comment