API Quick Start
Welcome to the Venkat AI API! This guide will help you make your first inference request in just a few minutes. We'll use Python for this example, but we offer SDKs for various languages.
1. Installation
First, install the official Venkat AI Python client library using pip:
pip install venkat-ai-client
2. Get Your API Key
You'll need an API key to authenticate your requests. You can find your API key in your account dashboard after signing up.
3. Make Your First Request
Now, let's use the client library to make a prediction using the Venkat AI Spark model. Replace "your_api_key" with your actual API key.
from venkat_ai import Client
import os
# It's recommended to use environment variables for API keys
# api_key = os.environ.get("VENKAT_API_KEY")
api_key = "your_api_key" # Replace with your key for testing
if not api_key:
raise ValueError("API key not found. Set the VENKAT_API_KEY environment variable.")
# Initialize the client
client = Client(api_key=api_key)
try:
# Define the input data for the model
input_data = {
"prompt": "Translate the following English text to French: 'Hello, world!'",
"max_tokens": 50
}
# Make the prediction request
response = client.predict(
model="venkat-spark", # Specify the model to use
input_data=input_data
)
# Print the result
print("Prediction Result:")
print(response)
except Exception as e:
print(f"An error occurred: {e}")
4. Understanding the Response
The response object will typically contain the model's output, along with metadata like request IDs and usage information. The exact structure depends on the model used.
{
"id": "pred_abc123xyz",
"model": "venkat-spark",
"output": {
"translation": "Bonjour, le monde!"
},
"usage": {
"prompt_tokens": 15,
"completion_tokens": 4,
"total_tokens": 19
}
}
Next Steps
Congratulations! You've made your first API request. Here are some next steps:
- Explore the Authentication guide for more secure ways to handle your API key.
- Check out the detailed Inference API Reference for all available parameters.
- Learn about our different Models and their capabilities.
- Try our language-specific SDKs & Libraries for easier integration.