AI Model Selection & Integration
Choose and integrate the right AI models for your automation needs
Last reviewed
What You'll Learn#
Model Selection
- • Comparing different AI models and providers
- • Understanding pricing and performance trade-offs
- • Choosing the right model for your use case
- • Evaluating model capabilities and limitations
Integration
- • Setting up API access and authentication
- • Building robust API integrations
- • Implementing error handling and retries
- • Optimizing for cost and performance
Popular AI Models#
List prices, checked November 2026. Prices change often, so confirm on the provider's page before you budget: Anthropic pricing, OpenAI pricing, Google Gemini pricing.
Claude Opus 5.5
by Anthropic
Strengths
- • Deep reasoning
- • Agentic coding
- • 1M token context
- • Long, multi-step tasks
Pricing
$4 input / $20 output per 1M tokens
Best For
Hard problems where quality matters more than cost: complex analysis, coding, agents
Claude Sonnet 5.5
by Anthropic
Strengths
- • Strong reasoning
- • Tool use
- • 1M token context
- • Good speed for its tier
Pricing
$2 input / $10 output per 1M tokens
Best For
Everyday production work: drafting, analysis, tool-using workflows
Claude Haiku 5.5
by Anthropic
Strengths
- • Very fast
- • Very low cost
- • 1M token context
- • Customer-facing chat
Pricing
$0.10 input / $0.50 output per 1M tokens (prompts up to 100K tokens; $0.50 / $2.50 above)
Best For
High-volume tasks: chat replies, classification, extraction, summaries
GPT-6.1 Sol
by OpenAI
Strengths
- • Flagship general purpose
- • Tool calling
- • Structured outputs
Pricing
$2 input / $10 output per 1M tokens (inputs up to 272K tokens)
Best For
General-purpose reasoning and content tasks in the OpenAI ecosystem
GPT-6 Luna
by OpenAI
Strengths
- • Low cost
- • Fast responses
- • Tool calling
Pricing
$0.10 input / $0.50 output per 1M tokens
Best For
Budget, high-volume workloads where speed beats depth
Gemini 3.1 Pro (preview)
by Google
Strengths
- • Multimodal input
- • Large context
- • Google Cloud integration
Pricing
$2 input / $12 output per 1M tokens (prompts up to 200K; $4 / $18 above)
Best For
Reasoning over mixed text, image, and video inputs
Gemini 3.1 Flash-Lite
by Google
Strengths
- • Very low cost
- • Multimodal input
- • Free tier available
Pricing
$0.25 input / $1.50 output per 1M tokens (free tier for testing)
Best For
Prototyping on a budget and simple high-volume tasks
Implementation Steps#
Choose Your Model
Start with the smallest model that does the job well
- Collect 20 to 50 real examples of the task and the answer you expect
- Run them through a small, low-cost model first, then step up only where it falls short
- Compare cost per completed task, not cost per request
- Review rate limits, data retention, and usage policies for your industry
Set Up API Access
Obtain credentials and configure your environment
- Create a developer account and set a monthly spend limit on day one
- Generate an API key and store it in a secret manager or environment variable
- Use a separate key per environment (development, staging, production)
- Install the official SDK and send one test request
Implement Integration
Build a robust integration and keep costs in check
- Use the official SDK: it already retries rate limits and server errors with backoff
- Handle refusals and truncated replies (check the stop reason) instead of assuming text
- Cache long, repeated instructions with prompt caching to cut input cost
- Send bulk, non-urgent jobs through a batch API (about half price on Anthropic)
- Log token usage per request so you can track spend, never the prompt contents if they hold customer data
AI Integration Example#
// Example: calling Claude from Node.js 20+ (ES modules)
// npm install @anthropic-ai/sdk
import Anthropic from '@anthropic-ai/sdk';
// Reads ANTHROPIC_API_KEY from the environment. Never hardcode keys.
// The SDK retries rate limits (429) and server errors (5xx) with backoff.
const client = new Anthropic({ maxRetries: 3 });
// Fast and low cost. Swap in 'claude-sonnet-5-5' for harder tasks.
const MODEL = 'claude-haiku-5-5';
export async function generateResponse(userMessage, { system, maxTokens = 1024 } = {}) {
const response = await client.messages.create({
model: MODEL,
max_tokens: maxTokens,
system,
output_config: { effort: 'low' }, // low effort suits short chat replies
messages: [{ role: 'user', content: userMessage }],
});
// The model can decline a request. Check before reading the text.
if (response.stop_reason === 'refusal') {
return { text: null, refused: true, usage: response.usage };
}
const text = response.content
.filter((block) => block.type === 'text')
.map((block) => block.text)
.join('');
return { text, refused: false, usage: response.usage };
}
// Usage
try {
const { text, usage } = await generateResponse('What time do you open on Saturday?', {
system: 'You answer questions for a local bakery. Keep replies under 60 words.',
});
console.log(text);
console.log(`Tokens: ${usage.input_tokens} in, ${usage.output_tokens} out`);
} catch (error) {
if (error instanceof Anthropic.RateLimitError) {
console.error('Still rate limited after retries. Queue the request and try later.');
} else if (error instanceof Anthropic.APIError) {
console.error(`API error ${error.status}`);
} else {
throw error;
}
}Or skip the build
If what you need is an assistant that answers customer questions, pAInpoint has already done the model work.
- • Model choice and tuning handled for you
- • Answers grounded in your own website
- • Hands the conversation to you when a person is needed
Next Steps#
Now that you understand AI model integration, learn how to process and validate data effectively in your AI pipelines.