POST
/
sdk
/
v1
/
prompts
/
{id}
/
completion
import PromptFoundry from '@prompt-foundry/typescript-sdk';

const client = new PromptFoundry({
  apiKey: process.env['PROMPT_FOUNDRY_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const completionCreateResponse = await client.completion.create('1212121');

  console.log(completionCreateResponse.provider);
}

main();
{
  "provider": "ANTHROPIC",
  "name": "<string>",
  "stats": {
    "inputTokenCount": 123,
    "outputTokenCount": 123,
    "latency": 123,
    "cost": 123
  },
  "message": {
    "content": [
      {
        "type": "TEXT",
        "text": "<string>"
      }
    ],
    "role": "assistant"
  }
}

Path Parameters

id
string
required
Example:

"1212121"

Body

application/json
variables
object

The template variables added to the prompt when executing the prompt.

overrideMessages
object[]

Replaces the configured prompt messages when running the prompt.

appendMessages
object[]

Appended the the end of the configured prompt messages before running the prompt.

user
string

A unique identifier representing your end-user, which can help monitor and detect abuse.

Response

200
application/json
Successful completion response
provider
enum<string>
required

The provider of the provided model.

Available options:
ANTHROPIC,
OPENAI
name
string
required
stats
object
required
message
object
required

The completion message generated by the model.