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.0

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.0
File Size Uploaded
cortiqa-0.1.0.tar.gz 14.9 kB Details

Built distribution (wheel)

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

Total release size: 31.3 kB

Release files / cortiqa-0.1.0.tar.gz

Download URL cortiqa-0.1.0.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e30077e053e5da5dd3bfe72a470646b71b50c076045654847098098c6599b58e
BLAKE2b-256 checksum
How to use checksums
8a333f4ad7172615eabf618a9c5cba2fbc2bf335b9282700bce1bb582f174685
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.0-py3-none-any.whl

Download URL cortiqa-0.1.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19b93e49c630a5edf795244a74826fff356a7a368c897e0044228a3810641849
BLAKE2b-256 checksum
How to use checksums
44bc787efa44d3b97f6796173d127546b333220446d2e8ba2ccbd35b5ef51a64
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

0.1.1

2 release files

This release

0.1.0 This release

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