v1

latestOpenAPI 3.1.0MIT2026-07-13174391.2 KB

Apply changes from big models into your files. Find your API key.

post/v1/chat/completions

Request body

OR

Example request

{
  "model": "morph-v3-fast",
  "messages": [
    {
      "role": "user",
      "content": "<instruction>I will add error handling</instruction>\n<code>function divide(a, b) {\n  return a / b;\n}</code>\n<update>function divide(a, b) {\n  if (b === 0) throw new Error('Division by zero');\n  return a / b;\n}</update>"
    }
  ],
  "max_tokens": 150
}

Response

Chat completion response

idstring required

Unique identifier for the completion

objectstring required

Object type

createdinteger required

Unix timestamp of when the completion was created

Example response

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "\ndef calculate_total(items):\n    total = 0\n    for item in items:\n        total += item.price\n    return total * 1.1  # Add 10% tax\n"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 32,
    "total_tokens": 57
  }
}
All 17 operations