Log in

SDKs & frameworks

Most of these need one constructor argument changed. The rest of your code doesn't move.

OpenAI SDK (Python)

Set base_url to this gateway's /v1 path; everything else is the SDK you already know.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.iqshard.com/v1",
    api_key="<your API key>",
)

response = client.chat.completions.create(
    model="<model id from the models list>",
    messages=[{"role": "user", "content": "ping"}],
)
print(response.choices[0].message.content)

Anthropic SDK (Python)

Set base_url to the bare origin — no /v1 suffix, the SDK appends its own path:

from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.iqshard.com",
    api_key="<your API key>",
)

message = client.messages.create(
    model="<model id from the models list>",
    max_tokens=1024,
    messages=[{"role": "user", "content": "ping"}],
)
print(message.content)

Vercel AI SDK

The @ai-sdk/openai-compatible provider points at any OpenAI-shaped endpoint:

import { generateText } from 'ai';
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';

const iqshard = createOpenAICompatible({
  name: 'iqshard',
  baseURL: 'https://api.iqshard.com/v1',
  apiKey: process.env.IQSHARD_API_KEY,
});

const { text } = await generateText({
  model: iqshard('<model id from the models list>'),
  prompt: 'ping',
});