SDKs & Libraries
Use the official OpenAI SDK today; native JS/Python SDKs are on the way.
Today, use the official OpenAI SDK. Tarqa implements the OpenAI API (POST /v1/chat/completions), so you only change the base URL, and that one client then reaches Claude, Gemini, GPT, Llama and all 60+ models.
The native Anthropic SDK (/v1/messages) and Google GenAI SDK (generateContent) use different request formats. Use the OpenAI SDK for every model, including Claude and Gemini.
OpenAI SDK (recommended)
- 1InstallcURL
npm install openai # or: pip install openai - 2Point it at TarqaSet
baseURL/base_urltohttps://api.tarqaai.com/api/v1. That's the only change. - 3Call any modelUse the model IDs from your dashboard.
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 ?? '');
}It works in any framework that can make HTTP calls: Next.js, React (through your backend), Vue, Svelte, Express, FastAPI, Django, Flask and more.
Native Tarqa SDKs (coming soon)
@tarqa/sdk (npm) and tarqa-sdk (PyPI) aren't released yet. The code below shows the planned API. Their extra feature is a runTools / run_tools helper that runs the whole tool-calling round trip for you, with your functions executing in your own process.
// npm install @tarqa/sdk
import { TarqaAI } from '@tarqa/sdk';
const client = new TarqaAI({ apiKey: process.env.TARQA_API_KEY });
// Chat
const response = await client.chat.create({
model: 'gemini-2.5-flash',
messages: [{ role: 'user', content: 'Hello!' }],
});
// 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 can use 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?' }],
});
// Let the model search your RAG index itself, as a tool
client.rag.enableSearchTool(conversation.id);FAQ
Can I call Claude with the OpenAI SDK?
model to a Claude ID like claude-opus-4-6. Tarqa handles the translation.Do I need a Tarqa SDK for tool calling?
tools parameter. The planned SDK only automates the round trip.