Chat with AI
Write a REST API endpoint in TypeScript
Claude 3.5
Here's a clean Express endpoint with Zod validation and error handling…
Code Generation
import
{ ShipGen }
from
'shipgenai'
;
const
ai =
new
ShipGen
({ apiKey: process.env.
SHIPGEN_KEY
});
const
res =
await
ai.chat .
completions
.
create
({ model:
'gpt-4o'
,
// swap anytime
messages: [{ role:
'user'
, content: prompt }] });
Unified Model Access
GPT-4o
~320ms
Claude 3.5 Sonnet
~290ms
Gemini 1.5 Pro
~410ms
Llama 3.1 70B
~180ms
Live API Stats
Requests Today
1.4
M
Uptime
99.9
%
GPT-4o 42%
Claude 28%
Other
Avg latency
318ms