Quickstart
Create an API key, send your first request to Olive, and read the response.
Create an API key
Sign in to the Avey API platform and create a key. The full key is shown once, when you create it. Store it in an environment variable, and keep it out of source control.
export AVEY_API_KEY="avey_sk1_..."Make a request
Send the key as a bearer token in the Authorization header. The OpenAI SDKs
send that header already, so set the key as api_key and nothing else.
curl https://api.avey.ai/llm/chat/completions \
-H "Authorization: Bearer $AVEY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "olive",
"messages": [
{ "role": "user", "content": "What are the red flags for headache in primary care?" }
]
}'Read the response
The response is an OpenAI chat completion, shortened here. Olive adds one field.
{
"id": "chatcmpl-8Qp0vJnZ2xTfKq3mBd1sYw",
"object": "chat.completion",
"created": 1753660800,
"model": "olive",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"reasoning_content": "The question is asking which features of a headache presentation raise the probability of a secondary cause...",
"content": "Screen for these red flags in any patient presenting with headache:\n\n1. **Thunderclap onset**: maximal intensity within a minute..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 412,
"total_tokens": 430
}
}message.reasoning_contentholds Olive's reasoning, kept apart from the answer incontent. An SDK that does not know the field may drop it. See Reasoning.finish_reasonisstopwhen Olive finished. It islengthwhen the response hit themax_tokensbudget, and the answer may be cut short. See Token budget.usageholds the token counts. On a stream, it arrives on the final chunk.
If the first request fails
- Every request returns
401. When you leaveapi_keyunset, an OpenAI SDK sends a key it finds in your environment instead. That key can belong to another project, and Avey answers401. Pass your Avey key explicitly. contentis empty andfinish_reasonislength. Reasoning used the wholemax_tokensbudget. Raisemax_tokens, or leave it unset. See Token budget.- Any other status. See Errors for what each status means and what to do.
Next steps
Last updated