/chat/completions endpoint to generate a model response from a conversation. This endpoint follows the OpenAI format for sending messages and receiving responses.
Requirements
To create a chat completion, provide the following:- The Serverless Inference service base URL:
https://api.inference.wandb.ai/v1. - Your CoreWeave Forge API key:
[YOUR-API-KEY]. - Your CoreWeave Forge team and Weights & Biases project (Optional):
[YOUR-TEAM]/[YOUR-PROJECT]. - A model ID from the available models.
Request examples
The following examples show how to send a chat completion request using Python andcurl. Replace the placeholder values with your own API key, optional team and project, and a model ID.
- Python
- Bash
Request parameters
The endpoint supports the following commonly used parameters to control how the model generates a response. Onlymodel and messages are required.
Not every model supports every parameter. The endpoint ignores parameters that it doesn’t recognize instead of returning an error, so check parameter names for typos.
Send parameters as fields in the JSON request body, at the same level as
model and messages. With the OpenAI SDK, pass them as keyword arguments to client.chat.completions.create(). The following example sets temperature and top_p:
- Python
- Bash