Request
curl
Body
json
OpenAI SDK
This endpoint offers compatibility with the OpenAI SDKs to support developers and their apps with minimal changes. Once you update the base URL, you can start using the SDKs to make calls to Modelslab with API key.1
Import the package
You can import the OpenAI python package into your python application and change the base URL and API key.
pip install openai
2
Python code
python
3
Response
json
Authorizations
Bearer token authentication using ModelsLab API key
Body
application/json
Array of chat messages with role and content
Model to use for chat completion
Maximum number of tokens allowed in the response
Required range:
1 <= x <= 44000
Sampling temperature for randomness
Required range:
0 <= x <= 2
Nucleus sampling parameter
Required range:
0 <= x <= 1
Presence penalty for token repetition
Required range:
-2 <= x <= 2
Frequency penalty for token repetition
Required range:
-2 <= x <= 2
Whether to stream back partial progress
Response
Chat completion response
Unique identifier for the chat completion
Object type
Available options:
chat.completion
Unix timestamp of creation
Model used for generation
Array of completion choices
Token usage information
Log probabilities for prompt tokens