Loading...
Loading...
Integrate Token.AI API in under 5 minutes
Visit the Token.AI signup page, enter your email and password, and create a team workspace.
Log into the console and create a new API Key under Settings → API Keys. Keep your key safe and never share it.
If you already use the OpenAI SDK, no extra packages are needed. Otherwise run:
npm install openaiUse the following code sample to call the API:
import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://api.thistoken.ai/v1',
apiKey: process.env.THISTOKEN_API_KEY,
})
async function main() {
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Hello!' }
],
})
console.log(response.choices[0].message.content)
}
main()Run your code to complete the first model call. View project usage, model distribution, and cost trends in the console.