chat

Create a chat completion

Generate a chat completion with any of Krater's 500+ chat models. OpenAI-compatible request and response format, including streaming via server-sent events when stream is true. Credits are charged dynamically based on the model and token usage.

post/chat/completions

Request

  • Base URL
    https://api.krater.ai/v1
  • Auth
    HTTP bearer

Request body

modelstring required

Model identifier, for example openai/gpt-4o-mini. Call listModels for the full catalog.

streamboolean

Stream the response as server-sent events.

temperaturenumber
max_tokensinteger
top_pnumber
frequency_penaltynumber
presence_penaltynumber
parallel_tool_callsboolean

Example request

{
  "model": "openai/gpt-4o-mini"
}

Response

Chat completion (JSON object, or a text/event-stream of chunks when stream is true).

idstring required
object'chat.completion' required
createdinteger

Unix timestamp.

modelstring

Example response

{
  "id": "chatcmpl-abc123",
  "choices": [
    {
      "finish_reason": "stop"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.