do not allow non-subscribers to use Claude

This commit is contained in:
Abi Raja 2024-03-19 13:38:09 -04:00
parent 3a1634bac2
commit 1d8f6641a2

View File

@ -286,6 +286,13 @@ async def stream_code(websocket: WebSocket):
)
raise Exception("No Anthropic key")
# Do not allow non-subscribers to use Claude
if payment_method != PaymentMethod.SUBSCRIPTION:
await throw_error(
"Please subscribe to a paid plan to use the Claude models"
)
raise Exception("Not subscribed to a paid plan for Claude")
completion = await stream_claude_response(
prompt_messages, # type: ignore
api_key=ANTHROPIC_API_KEY,