Skip to content

Th3-AI/DynaSpark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DynaSpark API Documentation 🌟

API Status License: MIT Version Python Client

The official documentation for the DynaSpark API - Your free AI generation platform

Try API | Try DynaSpark AI | Documentation | Python Client | Report Issues

πŸ“‹ Table of Contents

Overview

DynaSpark is a powerful AI generation platform that provides easy access to various AI models for text, image, and audio generation. The API is designed to be simple to use while offering advanced features for developers.

Key Features

  • πŸ€– Multiple AI models for text generation
  • 🎨 High-quality image generation with customization options
  • πŸ”Š Natural-sounding audio responses
  • πŸ”’ Simple authentication system
  • πŸ“Š Comprehensive rate limiting
  • πŸš€ Fast and reliable API endpoints

Quick Start

  1. Base URL: https://dynaspark.onrender.com/api
  2. Authentication: Currently, no API key is required
  3. Example Request:
curl "https://dynaspark.onrender.com/api/generate_response?user_input=Hello%20world"

Authentication

The API uses a simple API key authentication system. Include your API key in the request parameters:

?api_key=YOUR_API_KEY

Note: Currently, no API key is required for testing and development. You can use the API without authentication.

Endpoints

Text Generation

Generate text responses using various models and parameters.

Endpoint: /generate_response
Method: GET

Parameters

Parameter Type Description Default
user_input string The input text to generate a response for Required
api_key string Your API key Required
model string Model to use for generation None
temperature float Controls randomness (0.0-3.0) None
top_p float Controls diversity (0.0-1.0) None
presence_penalty float Penalizes repeated tokens (-2.0-2.0) None
frequency_penalty float Penalizes frequent tokens (-2.0-2.0) None
json boolean Return JSON response false
system string Custom system prompt None
stream boolean Stream the response false
private boolean Keep generation private false
seed integer Random seed for reproducibility None
referrer string Referrer information None
voice string Voice for audio response None

Example Request

curl "https://dynaspark.onrender.com/api/generate_response?user_input=What%20is%20AI%3F&temperature=0.8"

Example Response

{
    "response": "Artificial Intelligence (AI) is a branch of computer science...",
    "model": "default",
    "usage": {
        "prompt_tokens": 4,
        "completion_tokens": 150,
        "total_tokens": 154
    }
}

Image Generation

Generate images from text descriptions with various customization options.

Endpoint: /generate_image
Method: GET

Parameters

Parameter Type Description Default
user_input string The prompt to generate an image for Required
api_key string Your API key Required
width integer Image width (64-2048) 768
height integer Image height (64-2048) 768
model string Model to use (flux/turbo/gptimage) None
nologo boolean Exclude watermark false
seed integer Random seed None
wm string Custom watermark None

Example Request

curl "https://dynaspark.onrender.com/api/generate_image?user_input=A%20beautiful%20sunset&width=1024&height=768"

Example Response

{
    "image_url": "https://dynaspark.onrender.com/generated/image_123456.png",
    "model": "flux",
    "seed": 12345
}

Audio Response Generation

Generate natural-sounding audio responses using text generation with audio output.

Endpoint: /generate_response
Method: GET

Parameters

Parameter Type Description Default
user_input string The input text to generate a response for Required
api_key string Your API key Required
model string Must be "openai-audio" Required
voice string Voice to use "alloy"

Available Voices

Voice Description
alloy Balanced, natural-sounding voice (default)
echo Clear, professional voice
fable Warm, engaging voice
onyx Deep, authoritative voice
nova Bright, energetic voice
shimmer Soft, melodic voice

Example Request

curl "https://dynaspark.onrender.com/api/generate_response?user_input=Hello%20world&model=openai-audio&voice=nova" \
     --output response.mp3

Response

  • Binary audio data (MP3 format)
  • Content-Type: audio/mpeg

Response Formats

Text Generation

  • Default: JSON object with response field
  • With json=true: Full JSON response with metadata
  • With stream=true: Server-sent events stream

Image Generation

  • JSON object with image_url field
  • Image URL is valid for 24 hours

Audio Response

  • Binary MP3 data
  • Content-Type: audio/mpeg

Error Handling

The API uses standard HTTP status codes and returns error messages in JSON format:

{
    "error": "Error message description"
}

Common Error Codes

Code Description
400 Bad Request (invalid parameters)
401 Unauthorized (invalid API key)
429 Too Many Requests (rate limit exceeded)
500 Internal Server Error

Rate Limits

  • Free API Key: 100 requests per hour
  • Custom API Keys: Contact for limits

Rate limit headers are included in responses:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1625097600

Examples

Text Generation with Parameters

curl "https://dynaspark.onrender.com/api/generate_response?user_input=Write%20a%20poem&temperature=0.8&top_p=0.9&presence_penalty=0.6&frequency_penalty=0.6"

Image Generation with Custom Size

curl "https://dynaspark.onrender.com/api/generate_image?user_input=A%20futuristic%20city&width=1024&height=768&model=flux&nologo=true"

Audio Response with Different Voice

curl "https://dynaspark.onrender.com/api/generate_response?user_input=Hello%20world&model=openai-audio&voice=nova" \
     --output response.mp3

JSON Response

curl "https://dynaspark.onrender.com/api/generate_response?user_input=List%203%20colors&json=true"

API Status

Check the API status at: https://dynaspark.onrender.com/status

Support

For API support, feature requests, or bug reports:

Python Client

For a more convenient way to use the DynaSpark API in Python, check out our official Python client:

Python Client

The Python client provides:

  • 🐍 Simple Python interface
  • πŸ“¦ Easy installation via pip
  • 🎯 Full API support
  • πŸ”§ Type hints and IDE integration
  • πŸ›‘οΈ Built-in error handling

Quick example:

from dynaspark import DynaSpark

# Initialize client (no API key required)
client = DynaSpark()

# Generate text
response = client.generate_text("Hello, world!")
print(response.text)

View Python Client Documentation β†’


Made with ❀️ by Th3-C0der

GitHub YouTube Instagram LinkedIn Buy Me A Coffee

Releases

No releases published

Packages

No packages published

Languages