Skip to content
All documentation

API reference

Streaming responses

Receive output while the model generates it.

OPENAI BASE URLhttps://www.modelmesh.in/api/v1

Enable streaming

Set stream: true in a Chat Completions request. The gateway forwards server-sent events from the selected provider. Process chunks incrementally and close the stream when your application no longer needs it.

Protocol differences

Chat Completions uses chat delta chunks; Messages uses Anthropic events; Responses emits typed response events. Match your parser to the endpoint. Responses defaults to streaming unless stream is false.

Usage and failures

Final usage depends on upstream reporting. An HTTP success at stream start does not guarantee completion. Handle disconnects and error events. Retrying a partially completed request may create additional usage.

Request example

POSThttps://www.modelmesh.in/api/v1/chat/completions

Replace the key placeholder before running this example. This page does not send requests. Paid requests consume your allowance or funds.

$env:MODELMESH_API_KEY = 'YOUR_MODELMESH_KEY'

Invoke-RestMethod -Method Post -Uri 'https://www.modelmesh.in/api/v1/chat/completions' `
  -Headers @{Authorization="Bearer $env:MODELMESH_API_KEY"} `
  -ContentType 'application/json' `
  -Body '{
  "model": "YOUR_MODEL_ID",
  "messages": [
    {
      "role": "user",
      "content": "Say hello in one sentence."
    }
  ],
  "max_tokens": 64,
  "stream": true
}'