Skip to main content

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

Run the CLI or call the SDK to see the current catalog (the list changes as new models are added):

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

CLI

The yachay command ships with the package and covers the full developer workflow — authentication, fine-tuning jobs, inference, datasets, endpoints, and account management.

Authentication

# Sign in via browser (credentials saved to the OS keychain; auto-refreshed)
yachay login

# Check who you're signed in as
yachay auth status

# CI/non-interactive: pass a key directly (or set YACHAY_API_KEY)
YACHAY_API_KEY=yck_... yachay jobs list

Command groups

Group Example Description
auth yachay auth status Sign in/out and check credentials
models yachay models list List available inference models
jobs yachay jobs submit --model llama-3.1-8b --model-name my-bot --dataset train.jsonl --agreed-max-usd 10 Submit and manage fine-tuning jobs
jobs yachay jobs list, yachay jobs status <id>, yachay jobs download <id> Track and retrieve jobs
jobs yachay jobs estimate --model llama-3.1-8b --dataset-size-mb 5 Cost/ETA estimate before submitting
jobs yachay jobs cancel <id>, yachay jobs metrics <id>, yachay jobs extend-storage <id> Manage active jobs
datasets yachay datasets generate --task-type chat --source "..." AI-assisted dataset generation
datasets yachay datasets upload <file.jsonl> --model llama-3.1-8b --model-name my-bot --agreed-max-usd 10 Upload a BYO dataset
infer yachay infer playground --model llama-3.1-8b --prompt "Hello" Run a prompt through the inference playground
endpoints yachay endpoints deploy --job-id <id> --name my-endpoint Deploy a fine-tuned adapter to hosted inference
account yachay account me, yachay account prefs Account summary and notification preferences
billing yachay billing Show billing summary
chat yachay chat --model llama-3.1-8b --prompt "Hi" One-shot or interactive chat REPL

Useful flags

Flag Effect
--json Machine-readable JSON output on stdout (errors on stderr)
--yes / -y Skip confirmation prompts (CI/scripted use)
--api-key KEY Override stored credentials (also YACHAY_API_KEY env var)

Credential storage

Login credentials (refresh token) are stored in the OS keychain (macOS Keychain, Linux Secret Service, Windows Credential Manager). Run yachay logout to remove them.

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 in the Python client. Passing stream=True raises an APIError with a clear message. Submit a feature request at yachaymodels.com/support.
  • SDK-native fine-tuning methodsclient.jobs.* and client.datasets.* are not exposed on the Client object in v1. Use the yachay CLI (see the CLI section above) for the full fine-tuning and dataset workflow.
  • Embeddings — not available in v1.

Documentation

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

License

MIT — see LICENSE for 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.5.tar.gz (49.7 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.5-py3-none-any.whl (58.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yachay-0.1.5.tar.gz
  • Upload date:
  • Size: 49.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for yachay-0.1.5.tar.gz
Algorithm Hash digest
SHA256 41e08d4a98c8ca7e27394238c3f7c5f128dd31d222c428776ae1f4b9da0dc462
MD5 803dbbcc701af3d34315005d8d78568a
BLAKE2b-256 c46625e058a59c60a0d7d8518397d07977d8c32ca73915b95daa285c070748a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yachay-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 58.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for yachay-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f0aeca7a5e578cdf7c3481335ec3e45cc345543b188842153c98d4d3aa8784ec
MD5 577e49606345409a7de1cbe33f9d78b8
BLAKE2b-256 e164b0ccde8317104fd01e684d581551ba277a2b3d73bd23a26ac14125e64578

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 Sentry Error logging StatusPage Status page