Skip to content

Use the API

The API follows the OpenAI chat completions shape. Most clients only need a new base URL and a key.

Sign in to the portal, open API keys, and create one. The key is shown once. Keys are bound to your wallet: whatever you approved for spending also covers requests made with the key.

Production keys start with kat_live_, keys for the public test network with kat_test_.

Terminal window
curl https://api.katara.com/v1/chat/completions \
-H "Authorization: Bearer $KATARA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "katara/llama-3.1-8b-instruct@1",
"messages": [{"role": "user", "content": "Explain a Merkle tree in two sentences."}],
"max_tokens": 200
}'

The reply carries a katara object with the settled price and the provider that served it:

"katara": { "cost_usdc": "0.000018", "provider": "0xfFe5…38DC", "fallback": false }

On the public test network use https://api.staging.katara.com/v1 and a kat_test_ key.

from openai import OpenAI
client = OpenAI(base_url="https://api.katara.com/v1", api_key=os.environ["KATARA_API_KEY"])
reply = client.chat.completions.create(
model="katara/llama-3.1-8b-instruct@1",
messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)

Streaming works the same way with stream=True. The final chunk before [DONE] has an empty choices array and carries the katara charge.

GET /v1/models needs no key and returns every model with its capabilities, context window, and the lowest live price. See the API reference for the full shapes and the error codes.