Skip to main content

Cortiqa AI Python SDK

PyPI version Python Versions License: MIT

Official Python client library for Cortiqa AI and Falin Foundation Models. Built for enterprise scalability, agentic workflows, and ultra-fast inference.


⚡ Installation

pip install cortiqa

Or install with development dependencies:

pip install "cortiqa[dev]"

🚀 Quickstart

Set your API key as an environment variable:

export CORTIQA_API_KEY="sk-cortiqa-your-api-key"

Then create your first completion:

from cortiqa import Cortiqa

client = Cortiqa()

response = client.chat.completions.create(
    model="falin-01",
    messages=[
        {"role": "system", "content": "You are a helpful assistant by Cortiqa."},
        {"role": "user", "content": "Explain quantum computing in two sentences."}
    ],
    temperature=0.7,
)

print(response.choices[0].message.content)

🌊 Real-Time Streaming

Stream tokens in real-time as they are generated by the model:

from cortiqa import Cortiqa
import sys

client = Cortiqa()

stream = client.chat.completions.create(
    model="falin-01",
    messages=[
        {"role": "user", "content": "Write a short poem about sunrise in the Himalayas."}
    ],
    stream=True,
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        sys.stdout.write(chunk.choices[0].delta.content)
        sys.stdout.flush()

⚡ Asynchronous Support

High-concurrency async client using AsyncCortiqa:

import asyncio
from cortiqa import AsyncCortiqa

async def main():
    async with AsyncCortiqa() as client:
        response = await client.chat.completions.create(
            model="falin-pro",
            messages=[
                {"role": "user", "content": "Write a fast Go concurrent worker pool."}
            ]
        )
        print(response.choices[0].message.content)

asyncio.run(main())

🧠 Available Cortiqa Models

Model ID Provider Description Tier
falin-01 Cortiqa Flagship foundation model for fast reasoning & conversational AI Free / Starter
falin-pro Cortiqa Advanced model for complex coding, mathematical proofs, and system design Pro
falin-vision Cortiqa Multimodal vision, OCR, document perception, and image reasoning Free
falin-ultra Cortiqa Maximum reasoning capability for deep research and enterprise automation Enterprise

To query live models directly:

models = client.models.list()
for m in models:
    print(m.id, "-", m.description)

⚙️ Configuration & Options

client = Cortiqa(
    api_key="sk-cortiqa-...",                # Default: CORTIQA_API_KEY
    base_url="https://api.cortiqa.co",       # Default: https://api.cortiqa.co
    timeout=60.0,                            # Request timeout in seconds
    max_retries=2,                           # Auto-retries on transient failuress
)

🛡️ Error Handling

The SDK provides typed exceptions for predictable error handling:

from cortiqa import Cortiqa
from cortiqa.exceptions import AuthenticationError, RateLimitError, APIError

client = Cortiqa()

try:
    response = client.chat.completions.create(
        model="falin-01",
        messages=[{"role": "user", "content": "Hello!"}]
    )
except AuthenticationError:
    print("Invalid API Key! Check your sk-cortiqa key.")
except RateLimitError:
    print("Rate limit reached! Please slow down requests.")
except APIError as e:
    print(f"API failed with status {e.status_code}: {e.message}")

📄 License

MIT © Cortiqa AI

Metadata

Release files for cortiqa 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cortiqa 0.1.1
File Size Uploaded
cortiqa-0.1.1.tar.gz 18.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cortiqa 0.1.1
File Interpreter ABI Platform
cortiqa-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 33.1 kB

Release files / cortiqa-0.1.1.tar.gz

Download URL cortiqa-0.1.1.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e4cf5b3a3ec3be1e1ef2c2cf964e2b50d7d310d52c2b3a042eb142513e662c60
BLAKE2b-256 checksum
How to use checksums
e0326a5afbe2fb0d2085ddae989361c0fcb4a879c463c3b18c167af1e2509fb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / cortiqa-0.1.1-py3-none-any.whl

Download URL cortiqa-0.1.1-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3f310a21e73ef72c3396383912ba6f9c37855ba9dbd3ae6690b5f2ae1345b0e
BLAKE2b-256 checksum
How to use checksums
d91e0b2680a7bd9e6408bc07c776693f8db068e43732e7bb7e04b3074702366d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page