Create Chat Completion
Generate a response to a conversation using a specified network model’s preset.Endpoint
Request Body
ID of the model to use (from
/v1/models).List of messages in the conversation.
Enable Server-Sent Events streaming.
Message Format
Each message in themessages array should have:
One of:
system | user | assistant.The content of the message.
Response Modes
- Standard Response Mode
- Streaming Mode (SSE)
In standard mode, the API returns a complete response once generation is finished.
Example Request
Response Format
Response Fields
Unique identifier for the completion.
Always
chat.completion.Unix timestamp of creation.
Model used for generation.
List of completion choices.
Token usage information.
OpenAI SDK Integration
The Fortytwo API is fully compatible with the OpenAI Python and Node.js SDKs:Preview Rate Limiting
Chat completion requests are subject to rate limits while in Preview. See ‘Preview Limits & Quotas’ for more details.Error Responses
Common error responses for chat completions can be found in ‘Errors’.Next Steps
- Learn about ‘Preview Limits & Quotas’.
- Review ‘Authentication’ details.