Skip to main content

Official Python SDK for Freddy AI Assistant API

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

freddy-python

The official Python SDK for the Freddy API.

Installation

pip install aitronos-freddy

Usage

Prerequisites

Before using the SDK, you need to have:

  • A Freddy API Key
  • Your Organization ID

You can get these from the Freddy Hub.

Environment Variables

It's recommended to set your credentials as environment variables. You can create a .env file in your project root:

FREDDY_API_KEY="your-api-key-here"
FREDDY_ORG_ID="your-organization-id"

The client will automatically load these variables.

Synchronous Client

Here's a basic example of how to use the synchronous client:

from freddy import FreddyClient

# The client automatically picks up FREDDY_API_KEY from environment variables.
# You can also pass it directly: FreddyClient(api_key="your-key")
with FreddyClient() as client:
    response = client.responses.create(
        model="gpt-4.1",
        inputs=[{"role": "user", "texts": [{"text": "Hello, world!"}]}],
        organization_id="your-org-id" # Can be set via FREDDY_ORG_ID env var
    )
    print(response.output[0].content[0].text)

Asynchronous Client

The SDK also provides an asynchronous client for use with asyncio.

import asyncio
from freddy import AsyncFreddyClient

async def main():
    async with AsyncFreddyClient() as client:
        response = await client.responses.create(
            model="gpt-4.1",
            inputs=[{"role": "user", "texts": [{"text": "Hello, async world!"}]}],
            organization_id="your-org-id"
        )
        print(response.output[0].content[0].text)

if __name__ == "__main__":
    asyncio.run(main())

Development

Setup

  1. Clone the repository.

  2. Install dependencies using Poetry:

    poetry install
    

Running Tests

The SDK uses pytest.

Unit Tests

These tests don't require any API credentials and are very fast.

poetry run pytest

Integration Tests

These tests run against the actual Freddy API and require credentials. Make sure your .env file is set up as described in the Usage section.

# Run integration tests against the staging environment
poetry run pytest tests/integration/ --integration --env=staging

You can also run against local or production environments by changing the --env flag.

To see test coverage:

poetry run pytest --cov=freddy

Image Operations

The SDK provides comprehensive support for image generation, manipulation, and analysis.

Generate Images

from freddy import FreddyClient

with FreddyClient(api_key="your-api-key") as client:
    result = client.images.generate(
        organization_id="your-org-id",
        prompt="A serene mountain landscape at sunset",
        model="dall-e-3",
        size="1024x1024",
        amount=1
    )
    # Save generated images
    result.save_all("./output")

Upscale Images

result = client.images.upscale(
    organization_id="your-org-id",
    image="photo.jpg",
    target_width=2048,
    target_height=2048
)

Remove Background

result = client.images.remove_background(
    organization_id="your-org-id",
    image="photo.jpg"
)

Replace Background

result = client.images.replace_background(
    organization_id="your-org-id",
    image="photo.jpg",
    prompt="tropical beach with palm trees at sunset"
)

Cleanup (Remove Objects)

result = client.images.cleanup(
    organization_id="your-org-id",
    image="photo.jpg",
    mask="mask.png"  # White areas will be removed
)

Analyze Images

Analyze images using vision-capable AI models. Currently supports GPT-4 and GPT-5 series models.

result = client.images.analyze(
    organization_id="your-org-id",
    image="https://example.com/photo.jpg",  # URL or base64 data URL
    prompt="Describe this image in detail",
    model="gpt-4o-mini"  # Supports: gpt-4o-mini, gpt-4o, gpt-4.1-mini, gpt-5-mini, etc.
)
print(result.output[0].content[0].text)

Note: Claude models are not yet supported for image analysis.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

aitronos_freddy-0.1.2.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

aitronos_freddy-0.1.2-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file aitronos_freddy-0.1.2.tar.gz.

File metadata

  • Download URL: aitronos_freddy-0.1.2.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for aitronos_freddy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 637ac4151e7806bd3631af1d95e7ff909be6f2eec7c6a58051b2a36d5cda40dd
MD5 bcd69ca65c7d2895b2201a6d868b90b0
BLAKE2b-256 cdbbc41c7d54b173d3cf6949c7e76b0b6f3acbfe6d289753ca02572bc5a4c0ea

See more details on using hashes here.

File details

Details for the file aitronos_freddy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: aitronos_freddy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for aitronos_freddy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d6e5c8eff22eff10eb041cbf39678ffdd92a47dfb01df478ff8a547c0a7d0aca
MD5 296597e7351830dd9a29469fbb5890d7
BLAKE2b-256 3ec968c28f6eb955a8adedbedd5a21b0071f1439354e99b1eaa1e95c33098a36

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