Skip to main content
All Cerebrium endpoints are OpenAI-compatible, supporting both /chat/completions and /embedding. Below is a basic implementation of a streaming OpenAI-compatible endpoint. For a full example using vLLM, see the OpenAI-compatible endpoint example. A streaming-compatible Cerebrium function must:
  • Specify all the parameters that OpenAI sends in the function signature.
  • Return yield data, where yield signals streaming and data is the JSON-serializable object returned to the caller.
Here’s a small snippet from the example listed above:
Once deployed, set the base URL to the target function and use the Cerebrium JWT (from the dashboard) as the API key. Client code:
The output then looks like this: