Getting Started
Making requests
Here’s how you can make your first API request using the ShuttleAI API. Replace $SHUTTLEAI_API_KEY
with your API key, which you can find on our Dashboard.
When you send a request to the shuttle-2-turbo model with specified parameters like max_tokens and temperature, you’ll receive a response akin to this:
{
"choices": [
{
"finish_reason": "length",
"index": 0,
"message": {
"content": "This is a test!",
"role": "assistant"
}
}
],
"created": 1707784511,
"id": "chatcmpl-c18f90b794e8574ef85b8566b070ce55",
"model": "shuttle-2-turbo",
"object": "chat.completion",
"usage": {
"completion_tokens": 5,
"prompt_tokens": 13,
"total_tokens": 18
},
"x-sai": {
"id": "req_ha0c3xhopl262fcw0gkj08qwwz9nw",
"p": "p_i0YgtEwb"
}
}
This response illustrates the successful processing of your ChatCompletion
request.
Understanding the Response
- finish_reason: “length” indicates that the response ended because it reached the
max_tokens
limit. Other possible values include “stop” and “tool_calls”. - completion_tokens: Shows the number of tokens used to generate the response, which will not exceed the set
max_tokens
.
Want to receive data in real-time as it’s generated?
Explore Streaming!