Usage is the same as OpenAI's Chat/Completions interface, details can be found in the OpenAI documentation.Here, let's discuss Claude in detail.Things to note when using Claude2:
Please select the 'claude-2-web' model permission in Settings => Key Permissions List for the corresponding key.
The maximum model capacity is 100,000 tokens, and this interface has limited input to 90,000 tokens.
When using this model, only the model, messages, and stream parameters are meaningful; other parameters will be ignored.
If there are multiple messages in messages, they will be automatically serialized into a single string to meet the requirements of the Claude interface. If you don't want it to be automatically serialized by the backend, you can only place one element in the message list.
Example Claude2 request body:
{"model":"claude-2-web","messages":[{"role":"system","content":"You are Claude2, a large language model trained by the Anthropic company."},{"role":"user","content":"Who are you?"}],"stream":false}
Example Claude2 request body (real-time stream output):
{"model":"claude-2-web","messages":[{"role":"system","content":"You are Claude2, a large language model trained by the Anthropic company."},{"role":"user","content":"Who are you?"}],"stream":true}
The return format is consistent with OpenAI's ChatCompletions interface. In theory, programs that can use this interface and customize models should be directly compatible with the Claude provided by this interface."
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.