Skip to main content

Typed Python client SDK for the Arcanada Model Connector — unified API for AI CLI agents and cloud model providers.

Project description

arcanada-model-connector

PyPI Python License: MIT

Typed Python client SDK for the Arcanada Model Connector — a unified API for AI CLI agents (Claude Code, Cursor, Gemini, Codex) and cloud model providers (OpenRouter, Groq, Grok, embedding services).

pip install arcanada-model-connector

Quick start

from arcanada_model_connector import Client

client = Client(api_key="arc_api_...")
response = client.execute({
    "connector": "openrouter",
    "prompt": "Explain BGE-M3 in 30 words.",
    "model": "mistralai/mistral-small-3.2-24b-instruct",
})
print(response.result)

Async

import asyncio
from arcanada_model_connector import AsyncClient

async def main() -> None:
    async with AsyncClient(api_key="arc_api_...") as client:
        response = await client.execute({"connector": "openrouter", "prompt": "ping"})
        print(response.result)

asyncio.run(main())

Structured output with output_format + schema

response = client.execute({
    "connector": "openrouter",
    "prompt": "Return a JSON object with keys 'city' and 'population'.",
    "output_format": "json",
    "schema": {
        "type": "object",
        "properties": {
            "city": {"type": "string"},
            "population": {"type": "integer"},
        },
        "required": ["city", "population"],
    },
})
print(response.repair_report)  # native | guarded | failed
print(response.structured)

repair_report.pass_ is one of:

  • native — provider returned valid output, no repair needed.
  • guarded — output-guard middleware applied repair strategies successfully.
  • failed — output-guard exhausted retries; raised as GuardExhaustedError.

Error handling

from arcanada_model_connector import ConnectorError, GuardExhaustedError, TimeoutError

try:
    response = client.execute({"connector": "openrouter", "prompt": "..."})
except GuardExhaustedError as exc:
    print("guard exhausted:", exc.envelope.message)
except ConnectorError as exc:
    print(f"HTTP {exc.status}: {exc.envelope.type if exc.envelope else 'unknown'}")
    if exc.retry_after:
        print(f"retry after {exc.retry_after}s")
except TimeoutError as exc:
    print("timed out after", exc.timeout, "seconds")

The SDK redacts Authorization headers and Bearer tokens from exc.cause before raising, so safe to log.

Documentation

License

MIT © Arcanada


Жизнь одного человека имеет значение / One human life matters

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

arcanada_model_connector-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

arcanada_model_connector-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file arcanada_model_connector-0.1.0.tar.gz.

File metadata

File hashes

Hashes for arcanada_model_connector-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3c7ec2047baa79362928618243c4d2ec5584337015571f246665831dad163bc0
MD5 46b0dc5a3ac3624ef8cad5cb31183bc0
BLAKE2b-256 4abae15bee848b233cfb79a41fcf086eb8a4632566233a69e999527e7b3acadb

See more details on using hashes here.

File details

Details for the file arcanada_model_connector-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for arcanada_model_connector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41e248759e6a03db1164becddf24d0e5c93e8ad79b7e1959703a2cc4f8f23398
MD5 c3f3c7c94aa952239c59c5c3eb350fd0
BLAKE2b-256 1d5f6a091764d451afd135ed5a7ac28d50ca3c203c4d9d9815fca0d5fc5a2c6f

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