Run a model

Create a chat completion

Changed on

OpenAI-compatible chat completions. Errors use the v3 error body, which the OpenAI SDKs parse: error.code, error.param and error.type populate the SDK exception, and the x-should-retry header tells the SDK whether to retry. An empty API wallet answers 402 (deliberate divergence from OpenAI's 429 insufficient_quota: retrying cannot fix an empty wallet). With stream: true the response is text/event-stream in the OpenAI chunk dialect, terminated by data: [DONE]; a failure after streaming has begun is delivered as one in-band data: {"error": ...} event carrying the same error body. Errors before the first byte are JSON responses. A top-level field the model's input_schema does not list is ignored, except audio, functions and function_call, which get a 400.

post/chat/completions

Request

  • Base URL
    https://api.hedra.com/v3
  • Auth
    • API key in header Authorization
    • or HTTP bearer

Response

Successful Response

unknown required

Changes