Introduction
Welcome to the Blizzer API documentation. Our API provides advanced AI capabilities including text generation, chat completion, and image creation. This guide will help you integrate our powerful AI features into your applications.
Base URL for all API requests: https://api.blizzer.tech
Authentication
To authenticate your API requests, include your API key in the header of each request:
Authorization: Bearer YOUR_API_KEY
To obtain an API key, sign up for an account on our developer portal.
API Reference
Text Completion
POST https://api.blizzer.tech/v1/completions
Generate text completions based on a given prompt.
Parameters:
Name | Type | Description |
---|---|---|
prompt | string | The input text to base the completion on |
max_tokens | integer | The maximum number of tokens to generate |
temperature | float | Controls randomness (0-1, default 0.7) |
top_p | float | Optional. An alternative to sampling with temperature, called nucleus sampling |
n | integer | Optional. Number of completions to generate (default 1) |
Chat Completion
POST https://api.blizzer.tech/v1/chat/completions
Generate chat completions for interactive conversations.
Parameters:
Name | Type | Description |
---|---|---|
messages | array | An array of message objects with 'role' and 'content' |
max_tokens | integer | The maximum number of tokens to generate |
temperature | float | Controls randomness (0-1, default 0.7) |
top_p | float | Optional. An alternative to sampling with temperature, called nucleus sampling |
n | integer | Optional. Number of chat completion choices to generate (default 1) |
Image Generation
POST https://api.blizzer.tech/v1/images/generations
Generate images based on text descriptions.
Parameters:
Name | Type | Description |
---|---|---|
prompt | string | A text description of the desired image |
n | integer | Optional. Number of images to generate (default 1, max 10) |
size | string | Optional. Image size. Options: '256x256', '512x512', or '1024x1024' (default '1024x1024') |
response_format | string | Optional. The format of the generated images. Options: 'url' or 'b64_json' (default 'url') |
Examples
Text Completion
curl https://api.blizzer.tech/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"prompt": "Once upon a time in a land far, far away",
"max_tokens": 50,
"temperature": 0.7,
"n": 1
}'
Chat Completion
curl https://api.blizzer.tech/v1/chat/completions \
-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's the capital of France?"},
{"role": "assistant", "content": "The capital of France is Paris."},
{"role": "user", "content": "What's its population?"}
],
"max_tokens": 50,
"temperature": 0.8
}'
Image Generation
curl https://api.blizzer.tech/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"prompt": "A futuristic cityscape with flying cars",
"n": 1,
"size": "1024x1024",
"response_format": "url"
}'
Error Handling
Our API uses conventional HTTP response codes to indicate the success or failure of an API request. In general:
- 2xx range indicate success
- 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, etc.)
- 5xx range indicate an error with our servers
All error responses will include a JSON object with an `error` field containing a human-readable error message.
Example Error Response
{
"error": {
"message": "Invalid API key provided",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
Best Practices
- Always handle API errors gracefully in your application
- Use appropriate rate limiting to avoid overloading the API
- Keep your API key secure and never expose it in client-side code
- Implement caching when appropriate to improve performance
- Validate and sanitize user inputs before sending them to the API
- For chat applications, maintain conversation context for better results
- When generating images, be specific and descriptive in your prompts
- Monitor your API usage and set up alerts for unusual activity
Frequently Asked Questions
Q: What programming languages are supported?
A: Our API can be used with any programming language that can make HTTP requests. We provide official SDKs for popular languages like Python, JavaScript, Ruby, and Java.
Q: Is there a limit to the number of API calls I can make?
A: Yes, there are rate limits depending on your subscription plan. Basic plans typically have a limit of 60 requests per minute. Please check your account dashboard for your specific limits.
Q: Can I use the generated content for commercial purposes?
A: Yes, commercial use is allowed under our Enterprise plans. For other plans, please review our terms of service or contact our sales team for more information.
Q: How do you handle data privacy and security?
A: We take data privacy and security seriously. All data is encrypted in transit and at rest. We do not store or use your input data for purposes other than providing the requested services. For more details, please review our privacy policy.
Q: Can I fine-tune the models for my specific use case?
A: Yes, we offer model fine-tuning services for Enterprise customers. This allows you to tailor the AI models to your specific domain or use case. Contact our sales team for more information.