Skip to main content

Import

import kitefishai

client = kitefishai.Client(api_key="kf-...")

Constructor

kitefishai.Client(
    api_key=None,
    base_url=None,
    timeout=60.0,
    max_retries=2,
    http_client=None,
)

Parameters

api_key
str
Your KiteFishAI API key. Falls back to the KITEFISH_API_KEY environment variable. Raises AuthenticationError if neither is set.
base_url
str
API base URL. Defaults to https://api.kitefishai.com/v1. Falls back to KITEFISH_BASE_URL env var. Override for on-prem deployments.
timeout
float
Request timeout in seconds. Default 60.0.
max_retries
int
Number of retries on network errors and timeouts. Default 2. Set to 0 to disable.
http_client
httpx.Client
Bring your own httpx.Client for custom TLS, proxies, or connection pooling.

Resources

AttributeTypeDescription
client.chatChatChat completions
client.embeddingsEmbeddingsText embeddings

Context manager

The client can be used as a context manager — the underlying HTTP connection is closed automatically:
with kitefishai.Client(api_key="kf-...") as client:
    response = client.chat.complete(...)

Manual close

client = kitefishai.Client(api_key="kf-...")
# ... use client ...
client.close()