Quick Start Guide
This guide will help you get up and running with our AI API in just a few minutes. Follow these simple steps to make your first API call.
Prerequisites
Before you begin, you'll need:
- An account on our platform
- Developer mode activated
- API key (found in your account dashboard)
- API credits (purchased through your account)
Step 1: Authentication
All API requests require authentication using your API key. Include it in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Step 2: Make Your First API Call
Let's make a simple text completion request:
curl -X POST https://api.graphine.ai/api/v1/completions/text \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"prompt": "Write a hello world message."
}'
Step 3: Understand the Response
You'll receive a JSON response like this:
{
"success": true,
"data": {
"text": "Hello, world! Welcome to our AI API. This is a simple demonstration of the text completion capability. You can use this API to generate various types of content based on your prompts.",
"metadata": {
"conversation_id": "550e8400-e29b-41d4-a716-446655440000",
"model": "default-model",
"prompt_tokens": 5,
"completion_tokens": 32,
"total_tokens": 37,
"completion_time": 0.75
}
}
}
Step 4: Try a Chat Completion
Chat completions are perfect for conversational applications:
curl -X POST https://api.graphine.ai/api/v1/completions/chat \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What can I do with this API?"
}
]
}'
What's Next?
Happy building!