Quickstart

Quickstart demonstrating requests with curl

Authorization

First, create an API Key in your account. You can manage keys at Tenant > Api Keys.

Create a Simple Flow

Create a new flow in your account and call it taboo. Copy and paste this into the 'main' template:

Write a short Haiku on [[topic]], but do not use any of the following words:
[[forbidden]]

Select any default LLM

Query it

We can now use the API to run the request and inject our text snippets:

curl https://app.promptshuttle.com/api/v1/flows/taboo/runs  \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
  "parameters": {
    "topic": "rainbows",
    "forbidden": "color, light, brigt, sky"
  }
}'
{
  "creditsUsed": 20,
  "milliseconds": 880,
  "id": "667ed1ff1751b68ffa1e79cb",
  "timestamp": "2024-06-28T15:08:47Z",
  "flowId": "667ecbb6a03bdbf914eafabb",
  "tenantId": "663cdb85853bd82dc060ba3b",
  "flowRequest": {
    "parameters": {
      "topic": "rainbows",
      "forbidden": "color, light, brigt, sky"
    },
    "environment": null,
    "overrideModel": null,
    "tags": null,
    "entrypoint": null,
    "version": null
  },
  "requests": [
    {
      "shuttleRequestId": "667ed1ff1751b68ffa1e79cc",
      "messages": [
        {
          "role": "client",
          "text": "Write a short Haiku on rainbows, but do not use any of the following words:\ncolor, light, brigt, sky"
        }
      ],
      "model": "mixtral-8x7b-32768",
      "maxTokens": null,
      "seed": 0,
      "temperature": null,
      "topP": null,
      "topK": null,
      "id": "667ed1ff1751b68ffa1e79cd",
      "idCreated": "2024-06-28T15:08:47Z"
    }
  ],
  "responses": [
    {
      "model": "mixtral-8x7b-32768",
      "provider": "Groq",
      "usage": {
        "tokensIn": 39,
        "tokensOut": 23,
        "tokensTotal": 62,
        "costUsd": 0.00001488,
        "costCredits": 14
      },
      "textResponse": "Arc of hues in the air,\nWhispers of beauty dance,\nPeace after the storm.",
      "verbatimResponse": null
    }
  ],
  "creditsLeft": 10391068
}

Running through the UI

OpenAI Endpoint

If you already have code to talk to OpenAI, you can use the OpenAI-compatible endpoint Chat to route your requests to any of the supported Models. However, please note that this currently doesn't support prompt templating.

  curl https://app.promptshuttle.com/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PSHUTTLE_API_KEY" \
  -d '{
     "model": "fake-responder-fast",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'
  {
  "id": "667ec3eaa03bdbf914eafab7",
  "created": 1719583722,
  "model": "fake-responder-fast",
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 9,
    "total_tokens": 18
  },
  "choices": [
    {
      "index": 0,
      "message": {
        "content": "Say this is a test!",
        "role": "assistant"
      },
      "finish_reason": "stop"
    }
  ],
  "object": "chat.completion"
}

Last updated