SDKs & Libraries

Official SDKs for seamless integration

OpenAI-compatible API only

TarqaAI implements the OpenAI API specPOST /v1/chat/completions. The native Anthropic SDK (/v1/messages) and native Google GenAI SDK (generateContent) use different request formats and are not compatible. Use the OpenAI SDK with baseURL pointing to TarqaAI — you can then access Claude, Gemini, GPT-4, Llama, and all 60+ models through the same client.

OpenAI SDK

OpenAI SDK (recommended)

Drop-in replacement — change baseURL only, everything else stays the same
Installation
BASH
npm install openai   # or: pip install openai
JavaScript / TypeScript
TS
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.TARQA_API_KEY,
  baseURL: 'https://api.tarqaai.com/api/v1',  // only this line changes
});

// Works with any of the 60+ models
const response = await client.chat.completions.create({
  model: 'claude-opus-4-6',  // or gpt-4.1, gemini-2.5-pro, llama-4-maverick …
  messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(response.choices[0].message.content);

// Streaming
const stream = await client.chat.completions.create({
  model: 'gemini-2.5-flash',
  messages: [{ role: 'user', content: 'Tell me a story' }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}
Python
PY
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_TARQA_API_KEY",
    base_url="https://api.tarqaai.com/api/v1",  # only this line changes
)

response = client.chat.completions.create(
    model="gpt-4.1",  # or claude-opus-4-6, deepseek-r1 …
    messages=[{"role": "user", "content": "Hello!"}],
)

print(response.choices[0].message.content)

JS

TarqaAI JavaScript / TypeScript SDK

Coming Soon

For Node.js, React, Vue, Next.js, and more — not yet published to npm
Installation
BASH
npm install @tarqa/sdk
Planned quick start
TS
import { TarqaAI } from '@tarqa/sdk';

const client = new TarqaAI({
  apiKey: process.env.TARQA_API_KEY
});

// Chat Completion
const response = await client.chat.create({
  model: 'gemini-2.5-flash',
  messages: [
    { role: 'user', content: 'Hello!' }
  ]
});

console.log(response.choices[0].message.content);

// Streaming
for await (const chunk of client.chat.stream({
  model: 'gemini-2.5-flash',
  messages: [{ role: 'user', content: 'Tell me a story' }]
})) {
  process.stdout.write(chunk);
}

// RAG
const conversation = await client.context.createConversation({
  title: 'My Knowledge Base'
});

await client.rag.index({
  conversationId: conversation.id,
  documentText: 'Your document content...'
});

const answer = await client.rag.chat({
  conversationId: conversation.id,
  message: 'What does the document say?'
});

🐍

TarqaAI Python SDK

Coming Soon

For Flask, FastAPI, Django, and data science — not yet published to PyPI
Installation
BASH
pip install tarqa-sdk
Planned quick start
PY
from tarqa import TarqaAI, ChatCompletionRequest, Message

client = TarqaAI(api_key="sk-your-api-key")

# Chat Completion
response = client.chat.create(
    ChatCompletionRequest(
        model="gemini-2.5-flash",
        messages=[
            Message(role="user", content="Hello!")
        ]
    )
)

print(response.choices[0].message.content)

# Streaming
for chunk in client.chat.stream(
    ChatCompletionRequest(
        model="gemini-2.5-flash",
        messages=[Message(role="user", content="Tell me a story")]
    )
):
    print(chunk, end="", flush=True)

# RAG
conversation = client.context.create_conversation(
    title="My Knowledge Base",
    knowledge_base_type="custom"
)

client.rag.index(
    conversation_id=conversation['id'],
    document_text="Your document content..."
)

answer = client.rag.chat(
    conversation_id=conversation['id'],
    message="What does the document say?",
    model="gemini-2.5-flash"
)

Framework integration guides

Next.js
Server-side rendering with API routes
⚛️
React
Client-side chat applications
💚
Vue.js
Progressive web applications
🚂
Express.js
RESTful API backends
FastAPI
High-performance Python APIs
🎸
Django
Full-stack Python applications
🌶️
Flask
Lightweight Python microservices
🔥
Svelte
Reactive frontend applications