Skip to main content
This guide helps you send your first AGICTO API request in the OpenAI-compatible format. You will set the API Key, use the correct Base URL, and verify a Chat completions response.

Prerequisites

  • You have an AGICTO API Key
  • Your account has available balance or quota
  • Your environment can reach AGICTO API

1. Set your API Key

Send your API Key in the Authorization header.
Authorization: Bearer $API_KEY
Do not expose your API Key in client-side code, public repositories, or logs.

2. Use the Base URL

The AGICTO API Base URL is:
https://api.agicto.cn/v1/
Copy the Base URL shown in the console. Example requests use the full URL. This page uses Chat completions. The full request URL is:
https://api.agicto.cn/v1/chat/completions

3. Send a Chat request

Replace $API_KEY with your API Key. Replace model with a model available to your account.
curl https://api.agicto.cn/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {
        "role": "user",
        "content": "Say hello in one sentence."
      }
    ]
  }'

4. Use the OpenAI SDK

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AGICTO_API_KEY,
  baseURL: "https://api.agicto.cn/v1/"
});

const completion = await client.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Say hello in one sentence." }]
});

console.log(completion.choices[0].message.content);

Next steps

OpenAI compatibility

Learn how to migrate existing OpenAI SDK code.

API reference

Browse endpoint details synced from Apifox.