How do I use the Kunya API to generate text or images?
Kunya's API is OpenAI-compatible — generate an API key in Dashboard → Developers, then use it exactly like the OpenAI SDK. Set the base URL to `https://kunya.ai/api/v1` and your model to any Kunya model ID. Every model in Kunya is accessible from the same API key.
Getting started
- Sign in and go to Dashboard → Developers
- Create an API key — it starts with
kunya_ - Use it with the OpenAI SDK (Python or Node.js):
from openai import OpenAI
client = OpenAI(
api_key="kunya_YOUR_KEY",
base_url="https://kunya.ai/api/v1"
)
response = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Hello!"}]
)
What models can I use?
Any model available on Kunya — Claude Fable 5, GPT-5.4, Gemini 3.1 Pro, Llama 4, DeepSeek V3, Grok 4, and 90+ more. See the full API docs for model IDs.
Image generation
response = client.images.generate(
model="flux-pro",
prompt="A product photo of a white sneaker on a marble floor",
)
Rate limits and pricing
API calls are charged from your Kunya credits. Usage is tracked per model in Dashboard → Analytics.