---
title: "Completion"
method: POST
path: "/sdk/v1/prompts/{id}/completion"
---

# Completion

`POST /sdk/v1/prompts/{id}/completion`

Initiates a completion request to the configured LLM provider using specified parameters and provided variables. This endpoint abstracts the integration with different model providers, enabling seamless switching between models while maintaining a consistent data model for your application.

## Path parameters

- `id` string, required

## Request body

- GetCompletionBody
  - `variables` PromptVariables — The template variables added to the prompt when executing the prompt.
  - `overrideMessages` ConversationMessage[] — Replaces the configured prompt messages when running the prompt.
    - `content` MessageContentBlockSchema[], required
      - union
        - TextContentBlock
          - `type` 'TEXT', required
          - `text` string, required
        - ImageBase64ContentBlock
          - `type` 'IMAGE_BASE64', required
          - `imageBase64` string, required
          - `mediaType` string, required
        - ToolCallContentBlock
          - `type` 'TOOL_CALL', required
          - `toolCall` ToolFunctionCall, required
            - `toolCallId` string, required — TOOL_CALL_1
            - `type` 'function', required — The type of the tool. Currently, only `function` is supported.
            - `function` object, required
              - …
        - ToolResultContentBlock
          - `type` 'TOOL_RESULT', required
          - `toolCallId` string, required
          - `result` string, required
    - `role` 'assistant' | 'system' | 'tool' | 'user', required
  - `appendMessages` ConversationMessage[] — Appended the the end of the configured prompt messages before running the prompt.
    - `content` MessageContentBlockSchema[], required
      - union
        - TextContentBlock
          - `type` 'TEXT', required
          - `text` string, required
        - ImageBase64ContentBlock
          - `type` 'IMAGE_BASE64', required
          - `imageBase64` string, required
          - `mediaType` string, required
        - ToolCallContentBlock
          - `type` 'TOOL_CALL', required
          - `toolCall` ToolFunctionCall, required
            - `toolCallId` string, required — TOOL_CALL_1
            - `type` 'function', required — The type of the tool. Currently, only `function` is supported.
            - `function` object, required
              - …
        - ToolResultContentBlock
          - `type` 'TOOL_RESULT', required
          - `toolCallId` string, required
          - `result` string, required
    - `role` 'assistant' | 'system' | 'tool' | 'user', required
  - `user` string — A unique identifier representing your end-user, which can help monitor and detect abuse.

## Response `200`

Successful completion response

- CreateCompletionResponse
  - `provider` 'ANTHROPIC' | 'OPENAI', required — The provider of the provided model.
  - `name` string, required
  - `stats` CompletionStats, required
    - `inputTokenCount` number, required — The number of tokens in the input prompt.
    - `outputTokenCount` number, required — The number of tokens in the output completion.
    - `latency` number, required — The time in milliseconds it took to generate the completion.
    - `cost` number, required — The cost of generating the completion.
  - `message` object, required — The completion message generated by the model.
    - `content` MessageContentBlockSchema[], required
      - union
        - TextContentBlock
          - `type` 'TEXT', required
          - `text` string, required
        - ImageBase64ContentBlock
          - `type` 'IMAGE_BASE64', required
          - `imageBase64` string, required
          - `mediaType` string, required
        - ToolCallContentBlock
          - `type` 'TOOL_CALL', required
          - `toolCall` ToolFunctionCall, required
            - `toolCallId` string, required — TOOL_CALL_1
            - `type` 'function', required — The type of the tool. Currently, only `function` is supported.
            - `function` object, required
              - …
        - ToolResultContentBlock
          - `type` 'TOOL_RESULT', required
          - `toolCallId` string, required
          - `result` string, required
    - `role` 'assistant' | 'system' | 'tool' | 'user', required

## Other responses

- `400` — Missing or invalid parameters
- `401` — Unauthorized
- `404` — Not found
- `500` — Internal Server Error

---

[API](https://skmtc.net/prompt-foundry/apis/prompt-foundry-api.md) · [All operations](https://skmtc.net/prompt-foundry/apis/prompt-foundry-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/prompt-foundry/prompt-foundry-api/versions/84eb1e848fd1/schema)
