Getting Started

Quickstart

Get up and running with the Cortiqa API in 5 minutes. This guide walks you through getting your API key, installing the official SDK, and running your first inference.


Prerequisites

Step 1: Get Your API Key

Navigate to platform.cortiqa.co/api-keys and generate a secret API key. It starts with sk-cortiqa-....

Keep your API key secure
Never commit your secret API key to public source code. Always export it as an environment variable or store it in your cloud secret manager.
Terminal
export CORTIQA_API_KEY=sk-cortiqa-your-api-key-here

Step 2: Install the Cortiqa SDK

Choose your preferred language:

Terminal
# Python
pip install cortiqa

# TypeScript / Node.js
npm install @cortiqa/sdk

# Go
go get github.com/cortiqa-ai/cortiqa-sdk-go

Step 3: First Completion (Python)

Create a file named main.py using the official cortiqa package:

main.py
1from cortiqa import Cortiqa
2
3# Automatically reads CORTIQA_API_KEY from environment
4client = Cortiqa()
5
6response = client.chat.completions.create(
7 model="openai/gpt-oss-120b",
8 messages=[
9 {"role": "system", "content": "You are a helpful assistant by Cortiqa."},
10 {"role": "user", "content": "Explain quantum entanglement in two sentences."}
11 ],
12 temperature=0.7,
13)
14
15print(response.choices[0].message.content)

Step 4: TypeScript Quickstart

Using @cortiqa/sdk in Node.js or modern frontends:

index.ts
1import Cortiqa from "@cortiqa/sdk";
2
3const client = new Cortiqa();
4
5async function main() {
6 const message = await client.messages.create({
7 model: "openai/gpt-oss-120b",
8 max_tokens: 1024,
9 messages: [
10 { role: "user", content: "Explain how DNS resolution works in 2 sentences." }
11 ],
12 });
13
14 console.log(message.content);
15}
16
17main();

Step 5: Real-Time Streaming

Stream tokens directly as they are synthesized on Cortiqa LPU nodes:

stream_example.py
1import sys
2from cortiqa import Cortiqa
3
4client = Cortiqa()
5
6stream = client.chat.completions.create(
7 model="openai/gpt-oss-120b",
8 messages=[{"role": "user", "content": "Write a short poem about space exploration."}],
9 stream=True,
10)
11
12for chunk in stream:
13 if chunk.choices and chunk.choices[0].delta.content:
14 sys.stdout.write(chunk.choices[0].delta.content)
15 sys.stdout.flush()
You are ready to build!
You have now performed your first Cortiqa inferences. Check out our guides below for streaming, multi-turn chat, and tools.

Next Steps

Was this page helpful?