Skip to content

API Integration ​

CoreRouter supports multiple common API styles. Most OpenAI-compatible SDKs or frameworks only require three configuration changes:

ConfigurationValue
API Keysk-... created in console
Base URLhttps://api.corerouter.cloud/v1
Model IDModel ID from console, e.g., claude-sonnet-4-5

Choose Integration Method ​

  • curl: No SDK installation required. Ideal for troubleshooting API Keys, network issues, and Model IDs.
  • Endpoints & Capabilities Overview: Select Endpoint, Base URL, and model capabilities by use case.
  • Alpha Search API: Dedicated search endpoint for specific Agents or coding tools.
  • Python: Using the OpenAI Python SDK.
  • Node.js: Using the OpenAI Node.js SDK for JavaScript or TypeScript.
  • LangChain: For LangChain applications, Chains, Agents, or RAG.
  • Go HTTP: Direct API calls using Go's standard library.

API Types ​

Use CaseDocumentationBase URL
Chat, Tool Calling, VisionChat Completions / SDKhttps://api.corerouter.cloud/v1
Legacy Text CompletionModerations & Legacy Completionshttps://api.corerouter.cloud/v1
Agent, Codex, Responses WorkflowResponses APIhttps://api.corerouter.cloud/v1, model must support Responses
Agent Standalone SearchAlpha Search APIhttps://api.corerouter.cloud/v1, conditional support
Realtime Low-Latency Voice/TextRealtime WebSocketwss://api.corerouter.cloud/v1/realtime?model=...
Claude Code, Anthropic-Style ToolsAnthropic Messageshttps://api.corerouter.cloud
Gemini API ClientGemini APIhttps://api.corerouter.cloud
RAG, Vector SearchEmbeddingshttps://api.corerouter.cloud/v1
RAG Document RerankingRerankhttps://api.corerouter.cloud/v1
Content ModerationModerations & Legacy Completionshttps://api.corerouter.cloud/v1
Images, standard audio (compatible model required)Image & Audio APIshttps://api.corerouter.cloud/v1
Novita text-to-speechSpeech pluginhttps://api.corerouter.cloud, full path /novita/audio/speech
ElevenLabs text-to-speechMultilingual V2https://api.corerouter.cloud, full path /novita/elevenlabs/speech
Video Generation, Task PollingVideo & Async Taskshttps://api.corerouter.cloud/v1

If your client automatically appends /v1/chat/completions, /v1/messages, or Gemini paths, use the root Base URL. If you see /v1/v1 or duplicate paths, the Base URL format doesn't match your client's expectations.

Never hardcode API Keys in source code. Use environment variables on your local machine or deployment platform:

bash
export COREROUTER_API_KEY="sk-xxxxxxxxxxxxxxxx"
export COREROUTER_BASE_URL="https://api.corerouter.cloud/v1"
export COREROUTER_MODEL="claude-sonnet-4-5"

If using a .env file, ensure it's not committed to Git:

text
.env
.env.local

Minimal Examples ​

Python ​

python
from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["COREROUTER_API_KEY"],
    base_url="https://api.corerouter.cloud/v1",
)

completion = client.chat.completions.create(
    model="claude-sonnet-4-5",
    messages=[
        {"role": "user", "content": "Hello, please introduce yourself."}
    ],
)

print(completion.choices[0].message.content)

Node.js ​

typescript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.COREROUTER_API_KEY,
  baseURL: "https://api.corerouter.cloud/v1",
});

const completion = await client.chat.completions.create({
  model: "claude-sonnet-4-5",
  messages: [
    { role: "user", content: "Hello, please introduce yourself." },
  ],
});

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

Feature Support ​

CoreRouter can forward text chat, streaming, tool calling, vision, embeddings, image, and audio capabilities. Available features depend on the selected model and upstream provider. Refer to the console for model-specific capabilities.

Common Endpoints:

CapabilityEndpoint
Model ListGET /v1/models
Gemini Model ListGET /v1beta/models
Gemini OpenAI-Style Model ListGET /v1beta/openai/models
ChatPOST /v1/chat/completions
ResponsesPOST /v1/responses
Responses CompactPOST /v1/responses/compact
Alpha SearchPOST /v1/alpha/search
Anthropic MessagesPOST /v1/messages
GeminiPOST /v1beta/models/{model}:generateContent
EmbeddingsPOST /v1/embeddings
RerankPOST /v1/rerank
ModerationsPOST /v1/moderations
ImagesPOST /v1/images/generations, POST /v1/images/edits
Standard audio (separate setup required)POST /v1/audio/transcriptions, POST /v1/audio/translations, POST /v1/audio/speech
Novita text-to-speechPOST /novita/audio/speech, model minimax-speech-2.8-turbo
ElevenLabs text-to-speechPOST /novita/elevenlabs/speech, model elevenlabs-tts-multilingual-v2
RealtimeGET /v1/realtime?model=... WebSocket
Video TasksPOST /v1/videos, GET /v1/videos/{task_id}

See Endpoints & Capabilities Overview for complete details.

Model Selection ​

  • Chat: Select any available chat model from the console.
  • Agent / Coding Tools: Prefer models with Tool Calling, Streaming, long context, and Coding Agent support.
  • Codex / Responses: Must use a model that supports Responses from the console; standard chat models cannot be used directly as Responses models.
  • Vision: Select models with image input support.
  • Embeddings: Use Embeddings models, not chat model IDs.
  • Rerank: Use Rerank models, not chat model IDs.
  • Moderations: Select moderation models or confirm the default moderation model is available.
  • Realtime: Select Realtime models and use WebSocket connections.
  • Image, Audio, Video: Select models with the corresponding capabilities from the console, and note size, count, duration, and format limits.

Troubleshooting Steps ​

  1. Test with curl using the same API Key and Model ID.
  2. Confirm Base URL is https://api.corerouter.cloud/v1 for OpenAI-compatible endpoints.
  3. Confirm the Header is Authorization: Bearer sk-....
  4. Confirm the Model ID comes directly from the console, not display names.
  5. Check account balance, API Key permissions, model permissions, IP restrictions, and rate limits.
  6. If still failing, see Troubleshooting & FAQ.

Released under the MIT License.