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-0.1.6.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-0.1.6-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kognie_api-0.1.6.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-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ae4c031d8bd01f0c543c4b7a9e4341f3bfeec52a5fa05ddd67e8f0e9d1236e1b
MD5 c8a698972c885ba14b99ca103d8dc492
BLAKE2b-256 3c9dee6da6b2b6c8a5dec16ef66f34bba67f50a4ad83e3af9439fc4e7c74882c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kognie_api-0.1.6-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-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 eb5e87debc1632ab6d22a97524ddf0867e6a5b3899460c2ba3d1bbf69ec9f3b0
MD5 453bc53f3b8278c1731486405bf0fd6e
BLAKE2b-256 2a811a8244b331ea32fb4ed17ada90ed649ced15e020b6032ece77e016777898

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