SDKs
LLM API speaks the OpenAI API format, so any existing OpenAI SDK works unchanged — point its base_url (or baseURL) at LLM API and keep your provider's own SDK for its idioms (streaming helpers, types, retries).
base_url: https://api.llmapi.ai/v1
api_key: $LLM_API_KEY
Tools that speak Anthropic's native protocol (like Claude Code) are the one exception — see the Claude Code note for the base URL without /v1.
Vercel AI SDK
import { createOpenAI } from "@ai-sdk/openai";
const llmapi = createOpenAI({
baseURL: "https://api.llmapi.ai/v1",
apiKey: process.env.LLM_API_KEY!,
});
const completion = await llmapi.chat({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello, how are you?" }],
});
console.log(completion.choices[0].message.content);
OpenAI SDK
import OpenAI from "openai";
const openai = new OpenAI({
baseURL: "https://api.llmapi.ai/v1",
apiKey: process.env.LLM_API_KEY,
});
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello, how are you?" }],
});
console.log(completion.choices[0].message.content);
Other languages
For cURL, Python, Java, Rust, Go, PHP, and Ruby examples that don't need an SDK at all (plain HTTP), see Quickstart → Pick your language.