Page cover

Making requests

You can paste the command below into your terminal to run your first API request. Make sure to replace $HYPRLAB_API_KEY with your secret API key.

curl https://api.hyprlab.io/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $HYPRLAB_API_KEY" \
  -d '{
    "model": "gpt-3.5-turbo",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Say this is a test!"
      }
    ]
  }'

This request queries the gpt-3.5-turbo model to complete the text starting with a prompt of “Say this is a test”. You should get a response back that resembles the following:

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1706366696,
  "model": "gpt-3.5-turbo-0613",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "This is a test!"
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 13,
    "completion_tokens": 5,
    "total_tokens": 18
  },
  "system_fingerprint": null
}

Last updated