SDK
TypeScript and Python, drop-in completions.
Install the InferAPI client, or keep Vercel AI SDK / LangChain and set the base URL. Same chat-completions contract on every path.
- InferAPI SDK
- Vercel AI SDK
- LangChain SDK
npm install inferapi zod
import { InferAPI, responseFormat } from "inferapi";
import { z } from "zod";
const client = new InferAPI({ apiKey: process.env.INFERAPI_KEY });
const schema = z.object({ family_name: z.string() });
const out = await client.chat.completions.create({
messages: [{ role: "user", content: "Extract the family name" }],
response_format: responseFormat(z.toJSONSchema(schema), "id"),
});
pip install inferapi
from inferapi import InferAPI, response_format
client = InferAPI(api_key="…")
out = client.chat.completions.create(
messages=[{"role": "user", "content": "Extract the family name"}],
response_format=response_format({
"type": "object",
"properties": {"family_name": {"type": "string"}},
}, "id"),
)
Frameworks
Any client that can hit a chat-completions endpoint can hit InferAPI. Set the base URL to https://api.inferapi.quest/v1 and keep your existing tool chain.