Skip to main content

No project description provided

Project description

Kognie Python API

A Python client for interacting with the Kognie API to generate text and images.

!!! IMPORTANT

You must create an official Kognie API key by visiting : https://kognie.com/api

Installation

pip install kognie_api

Usage

Importing the library

from kognie_api import Kognie

Initialization

Create a new instance of the Kognie client with your API key.

kognie_client = Kognie(api_key="your_api_key_here")

Text Generation

Generate text using models like GPT-4. You can get the list of supported models at : https://kognie.com/models

# Generate text with default model (gpt-4)
response = kognie_client.generateText("What is the capital of France?")
print(response)

# Generate text with a specific model
response = kognie_client.generateText("What is the capital of France?", model="gpt-4o")
print(response)

Parameters

  • question (str): The prompt for text generation
  • model (str, optional): The model to use (default: "gpt-4")

Image Generation

Generate images using models like DALL-E.

# Generate image with default parameters
response = kognie_client.generateImage("A sunset over mountains")
print(response)

# Generate image with specific parameters
response = kognie_client.generateImage(
    question="A sunset over mountains",
    model="dall-e-2", 
    response_format="base64", 
    aspect_ratio="1:1"
)
print(response)

Parameters

  • question (str): The prompt for image generation
  • model (str, optional): The model to use (default: "dall-e-2")
  • response_format (str, optional): Format of the response (default: "base64")
  • aspect_ratio (str, optional): Aspect ratio of the generated image (default: "1:1")

Error Handling

The methods return a dictionary with the API response if successful. If an error occurs, they return a dictionary with an "error" key containing details about the error.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kognie_api-1.4.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kognie_api-1.4.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file kognie_api-1.4.0.tar.gz.

File metadata

  • Download URL: kognie_api-1.4.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for kognie_api-1.4.0.tar.gz
Algorithm Hash digest
SHA256 14ca4b9541456917972f32ff6e27441e899d8ab539679c8957847db9d7f3143c
MD5 dfb7eb85a69be955591e151f7f03f575
BLAKE2b-256 47ee4da72de6e1066c90311d4ef6c6e95d7c7c1bea03d38aed341cb980888da3

See more details on using hashes here.

File details

Details for the file kognie_api-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: kognie_api-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for kognie_api-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb48120e798a38cd254b3c2f4fc071bcf125f043dd8c7abd98f17a586084ea70
MD5 8cfde41a256b6e528018e36f2e51c277
BLAKE2b-256 e5d9134f01e68651fdea0fb386fc7011404b7be0f452212e67b00c202c6d06ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page