OpenAI-compatible API that allows you to create chat conversations and receive responses and also supports OpenAI SDKs.
Import the package
pip install openaiPython code
Response
Bearer token authentication using ModelsLab API key
Array of chat messages with role and content
Model to use for chat completion
Maximum number of tokens allowed in the response
1 <= x <= 44000Sampling temperature for randomness
0 <= x <= 2Nucleus sampling parameter
0 <= x <= 1Presence penalty for token repetition
-2 <= x <= 2Frequency penalty for token repetition
-2 <= x <= 2Whether to stream back partial progress
Chat completion response
Unique identifier for the chat completion
Object type
chat.completion Unix timestamp of creation
Model used for generation
Array of completion choices
Token usage information
Log probabilities for prompt tokens