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.

AI

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-dev.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-dev.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?'
});

// Tool calling — register once, every chat call auto-discovers it
client.tools.register({
  name: 'get_customer',
  description: 'Look up a customer by ID',
  parameters: {
    type: 'object',
    properties: { id: { type: 'string' } },
    required: ['id'],
  },
  handler: async ({ id }) => myApp.db.getCustomer(id), // runs in YOUR process
});

const result = await client.chat.runTools({
  model: 'claude-sonnet-4-5',
  messages: [{ role: 'user', content: 'Who is customer 42?' }],
});
console.log(result.choices[0].message.content);

// RAG as a tool the model can call itself, instead of always-on context injection
client.rag.enableSearchTool(conversation.id);
await client.chat.runTools({
  model: 'claude-sonnet-4-5',
  messages: [{ role: 'user', content: 'What does the document say about pricing?' }],
});

🐍

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="tai-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"
)

# Tool calling — register once, schema auto-inferred from type hints + docstring
def get_customer(id: str) -> dict:
    """Look up a customer by ID."""
    return my_app_db.get_customer(id)  # runs in YOUR process

client.tools.register(get_customer)

result = client.chat.run_tools(
    ChatCompletionRequest(
        model="claude-sonnet-4-5",
        messages=[Message(role="user", content="Who is customer 42?")],
    )
)
print(result.choices[0].message.content)

# RAG as a tool the model can call itself, instead of always-on context injection
client.rag.enable_search_tool(conversation['id'])
client.chat.run_tools(
    ChatCompletionRequest(
        model="claude-sonnet-4-5",
        messages=[Message(role="user", content="What does the document say about pricing?")],
    )
)

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