Quickstart
The CHAI API lets you programmatically call the same models that powers the CHAI app.
Get an API key
Go to the log in button on the top right corner of this page. You will be assigned an API key. It's accessible in the "credentials" section in the API doc.
Once you've gotten an API key, set your account's API key to an environment variable named CHAI_API_KEY
.
Test out the API
To test out the API, you can go directly to terminal to try it out using cURL.
For example, to start your first chat:
curl --request POST "https://api.chai-research.com/v1/chat/completions" \
-header "X-API_KEY: $CHAI_API_KEY" \
-header "Content-Type: application/json" \
--data '{
"model": "chai",
"messages": [
{
"role": "ai",
"content": "You walk through a dark forest. Suddenly the leaves stops and everything becomes quiet."
}
]
}'
Congratulations, you've just made your first call to CHAI API!
Updated about 2 months ago