Skip to main content

Python SDK for Yachay — Condor Models inference API (OpenAI-compatible)

Project description

Yachay Python SDK

Python client for Yachay — Condor Models inference API. Designed to feel like the OpenAI SDK so migrating existing code takes minutes.

Install

pip install yachay

Requires Python 3.9+.

Quickstart

import yachay

client = yachay.Client()  # reads YACHAY_API_KEY from environment

response = client.chat.completions.create(
    model="llama-3.1-8b",
    messages=[{"role": "user", "content": "Explain gradient descent in one paragraph."}],
)
print(response.choices[0].message.content)

Authentication

Create a customer API key in the Yachay dashboard. Keys are prefixed yck_.

Recommended — environment variable:

export YACHAY_API_KEY="yck_your_key_here"

Or pass directly:

client = yachay.Client(api_key="yck_your_key_here")

Available models

Two models are currently available for inference:

Model ID Description
llama-3.1-8b Meta Llama 3.1 8B — fast general-purpose chat
deepseek-r1-distill-llama-8b DeepSeek R1 distilled into Llama 8B — strong reasoning

To list available models programmatically:

models = client.models.list()
for model in models.data:
    print(model.id)

Chat completions

response = client.chat.completions.create(
    model="deepseek-r1-distill-llama-8b",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is the capital of Peru?"},
    ],
    max_tokens=256,
    temperature=0.7,
)

# Access the generated text
print(response.choices[0].message.content)

# Access token usage
print(f"Tokens used: {response.usage.total_tokens}")

Context manager

with yachay.Client() as client:
    response = client.chat.completions.create(
        model="llama-3.1-8b",
        messages=[{"role": "user", "content": "Hello!"}],
    )
    print(response.choices[0].message.content)
# HTTP connection pool is closed automatically

Migrating from OpenAI

The client mirrors the OpenAI SDK's nested-namespace pattern. Replace:

# Before
import openai
client = openai.OpenAI(api_key="sk-...")
response = client.chat.completions.create(model="gpt-4o", messages=[...])

with:

# After
import yachay
client = yachay.Client(api_key="yck_...")
response = client.chat.completions.create(model="llama-3.1-8b", messages=[...])

Response objects share the same shape: .choices[0].message.content, .usage.total_tokens, etc.

Error handling

from yachay import AuthError, RateLimitError, APIError

try:
    response = client.chat.completions.create(...)
except AuthError:
    print("Invalid API key")
except RateLimitError:
    print("Slow down — you are being rate-limited")
except APIError as e:
    print(f"API error {e.status}: {e.body}")

All errors are subclasses of yachay.YachayError.

Custom base URL and timeout

client = yachay.Client(
    api_key="yck_...",
    base_url="https://api.yachaymodels.com/v1",  # default; override for testing
    timeout=30.0,  # seconds
)

What v1 does NOT include

  • Streamingstream=True is not yet supported. Submit a feature request at yachaymodels.com/support.
  • Fine-tuning job management — submitting training jobs, downloading adapters, and managing the fine-tuning pipeline are not available through this SDK in v1. Use the Yachay web dashboard for job management.
  • Embeddings — not available in v1.

Documentation

Full API reference and guides at yachaymodels.com/docs.

License

MIT — see LICENSE 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

yachay-0.1.2.tar.gz (86.8 kB view details)

Uploaded Source

Built Distribution

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

yachay-0.1.2-py3-none-any.whl (55.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yachay-0.1.2.tar.gz
  • Upload date:
  • Size: 86.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for yachay-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5b67f1c5136c792e843c3da261eb2f6410bde6c752a49594f6585d569a683ce9
MD5 15525aac115874219a3b7db93b84284b
BLAKE2b-256 b0095a50833c9c47b0c3eb375cc3c75f94b2c3e68a67f235a5c9c6e0313894d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yachay-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 55.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for yachay-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 857679bd71f0ad68ba353f9bfd0176eace120c6bba32e68449b3fa61ec8cbe45
MD5 d8fada1a7e155847a897b06a9f10539a
BLAKE2b-256 98d6aae5ce3941b961f71aab2e14a3b73f9f117b7ed700215ed03c01e651a58b

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