LLM API (Claude or OpenAI)
Send a prompt to a hosted model and get text back, streamed if you like.
Pick it when You want the strongest models and the quickest start.
Skip it if Your data must never leave your own machines.
- Top-quality models with no hardware
- A few lines of code
- Streaming and tool calls supported
- You pay for every call
- Your data goes to another company
- Quick to set up
- Cheap while small
- Easy to leave
- Room to grow
PricePay per use, by amount of text
How to connect it
- Create an account and an API key.
- Store the key as a server-side secret, never in the browser.
- Call the API from a server route with the user's prompt.
- Stream the reply back and set a timeout and a per-user limit.
ANTHROPIC_API_KEYOPENAI_API_KEY
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic(); // reads ANTHROPIC_API_KEY
export async function POST(req: Request) {
const { prompt } = await req.json();
const msg = await client.messages.create({
model: process.env.AI_MODEL!, // pick a current model in your settings
max_tokens: 500,
messages: [{ role: "user", content: prompt }],
});
return Response.json(msg.content);
}