# Create Chat Completion — Featherless

> Generate a chat completion using a Featherless-hosted model (POST /v1/chat/completions). Returns a completion object whose choices[0].message.content holds the model's reply, plus a usage token breakdown. Use List Models first to discover…

- Key: `featherless-create-chat-completion`
- Type: Action (Write)
- Version: 0.0.1
- App: Featherless (`featherless`) — https://pipedream.com/apps/featherless.md
- This page (HTML): https://pipedream.com/apps/featherless/actions/create-chat-completion
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/featherless/actions/create-chat-completion/create-chat-completion.mjs

## Description

Generate a chat completion using a Featherless-hosted model (POST /v1/chat/completions). Returns a completion object whose `choices[0].message.content` holds the model's reply, plus a `usage` token breakdown. Use **List Models** first to discover valid model IDs to pass to the `model` prop. Example: `model=Qwen/Qwen3-0.6B`, `messages=[{"role":"user","content":"What is 2 + 2?"}]` returns a reply of `4` in `choices[0].message.content`. [See the documentation](https://featherless.ai/docs/completions).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `model` | `string` | Yes | The model ID to use, e.g. Qwen/Qwen2.5-7B-Instruct. Run List Models first to discover valid model IDs available to your account (do NOT guess). |
| `messages` | `string` | Yes | A JSON array of message objects. Example: [{"role":"system","content":"You are helpful."},{"role":"user","content":"What is 2 + 2?"}]. Parsed with JSON.parse in run(). |
| `maxTokens` | `integer` | No | Maximum number of tokens to generate (maps to max_tokens). |
| `minTokens` | `integer` | No | Minimum number of tokens to generate (maps to min_tokens). |
| `temperature` | `string` | No | Sampling temperature as a float, e.g. 0.7. Parsed to a number in run(). |
| `topP` | `string` | No | Nucleus sampling probability as a float, e.g. 0.9 (maps to top_p). |
| `topK` | `integer` | No | Top-k sampling cutoff (maps to top_k). |
| `minP` | `string` | No | Minimum probability threshold as a float, e.g. 0.05 (maps to min_p). |
| `presencePenalty` | `string` | No | Presence penalty as a float, e.g. 0.0 (maps to presence_penalty). |
| `frequencyPenalty` | `string` | No | Frequency penalty as a float, e.g. 0.0 (maps to frequency_penalty). |
| `repetitionPenalty` | `string` | No | Repetition penalty as a float, e.g. 1.0 (maps to repetition_penalty). |
| `seed` | `integer` | No | Random seed for deterministic sampling. |
| `stop` | `string[]` | No | One or more strings that stop generation when encountered. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "featherless",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "featherless-create-chat-completion",
  arguments: {
    model: "Model",
    messages: "Messages",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "featherless-create-chat-completion",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    featherless: { authProvisionId: "apn_xxxxxxx" },
    model: "Model",
    messages: "Messages",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "featherless-create-chat-completion",
    "configured_props": {
      "featherless": { "authProvisionId": "apn_xxxxxxx" },
      "model": "Model",
      "messages": "Messages"
    }
  }'
```

---

- App: https://pipedream.com/apps/featherless.md · All apps: https://pipedream.com/apps
