678APIdocs
https://www.678api.com/v1
SDK

LangChain and SDK integration

Any SDK that supports a custom OpenAI-compatible Base URL can connect to 678API.

Install and configure

text
npm install @langchain/openai
export API678_API_KEY="YOUR_API_KEY"

LangChain JS

text
import { ChatOpenAI } from "@langchain/openai";

const model = new ChatOpenAI({
apiKey: process.env.API678_API_KEY,
configuration: { baseURL: "https://www.678api.com/v1" },
model: "MODEL_ID_FROM_CONSOLE",
});

OpenAI SDK

text
import OpenAI from "openai";

const client = new OpenAI({
apiKey: process.env.API678_API_KEY,
baseURL: "https://www.678api.com/v1",
defaultHeaders: { "User-Agent": "678API-Node/1.0" },
});

const response = await client.chat.completions.create({
model: "MODEL_ID_FROM_CONSOLE",
messages: [{ role: "user", content: "Hello" }],
});

Production checklist

  • Use the exact model ID shown in the 678API console.
  • Create separate keys for development, staging, and production; set request timeouts and bounded retries.
  • Log timing, model, and error codes without logging full keys or sensitive user content.
  • Keep keys on the server. Never bundle a real key into browser code, desktop installers, or public repositories.

Common issues

SymptomCheck
SDK still calls official OpenAIUse baseURL in JavaScript or base_url in Python and set it to https://www.678api.com/v1.
Browser reports CORSDo not expose the key in frontend code; call 678API through your own backend.
Tool calling failsVerify plain chat first, then confirm the selected model and route support tools or function calling.
© 2026 678API · AI API Gateway Documentation