Making a Request

Authentication

All requests to the Lune API must include a Authorization: Bearer header with your API key. If you are using the OpenAI client SDKs, then the SDK will send the header on your behalf with every request. If integrating directly with the API you'll need to set this header yourself.

Content types

The Lune API always accepts JSON in request bodies and returns JSON in response bodies. You will need to send the content-type: application/json header in requests. If you are using the Client SDKs, this will be taken care of automatically. The response format adheres to the response format of OpenAI's chat completion and chat completion chunk formats, with the only exceptions being the additional features that are unsupported by OpenAI.

Example Request

curl https://api.trylune.ai/chat/completions \
   -H "Content-Type: application/json" \
   -H "Authorization: Bearer $LUNE_API_KEY" \
   -d '{
         "messages": [
           {"role": "user", "content": "What is the format of the AIMessageChunk object in Langchain?"}
         ],
         "model": "tycho",
         "stream": true
       }'