Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kymaapi.com/llms.txt

Use this file to discover all available pages before exploring further.

Kyma supports the Anthropic Messages API format. If your app uses the Anthropic SDK, just change the base URL and API key.

Python

import anthropic

client = anthropic.Anthropic(
    base_url="https://kymaapi.com",
    api_key="ky-your-api-key",
)

message = client.messages.create(
    model="llama-3.3-70b",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Hello! What can you do?"}
    ],
)

print(message.content[0].text)

JavaScript / TypeScript

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://kymaapi.com",
  apiKey: "ky-your-api-key",
});

const message = await client.messages.create({
  model: "qwen-3-32b",
  max_tokens: 1024,
  messages: [
    { role: "user", content: "Write a haiku about coding" },
  ],
});

console.log(message.content[0].text);

With system prompt

message = client.messages.create(
    model="llama-3.3-70b",
    max_tokens=1024,
    system="You are a helpful coding assistant.",
    messages=[
        {"role": "user", "content": "Write a Python fibonacci function"}
    ],
)

Streaming

with client.messages.stream(
    model="llama-3.3-70b",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Tell me a story"}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

Switching from Claude to Kyma

If you’re already using Claude, the only changes needed are:
# Before (Claude)
client = anthropic.Anthropic()  # uses ANTHROPIC_API_KEY

# After (Kyma)
client = anthropic.Anthropic(
    base_url="https://kymaapi.com",
    api_key="ky-your-api-key",
)
Then change the model name:
Claude ModelKyma EquivalentNotes
claude-sonnet-4llama-3.3-70bBalanced all-rounder
claude-haiku-3.5qwen-3-32bFast active model
claude-opus-4qwen-3.6-plusHighest quality
Kyma models are open-source/open-weight alternatives. They’re different from Claude and use Kyma credits after signup bonus.

Prompt Caching

Prompt caching is automatic. Your system prompt and tool definitions are cached for 5 minutes, reducing costs by up to 90% on subsequent requests. No code changes needed. See Prompt Caching for details.