Last updated: 2026-06-23
When To Use This Guide
Crazyrouter supports the official OpenAI SDK for OpenAI-compatible routes. Use it for chat, Responses API, images, audio, embeddings, and model listing. For video, Kling, Luma, Suno, Midjourney, and other async or provider-native routes, use the same API key withfetch against Crazyrouter native paths.
Default international API entry:
Install The SDK
fetch, FormData, and Blob.
Configure Environment Variables
macOS / Linux:Create A Client
Chat Completions
Streaming
Model Listing
Embeddings
Responses API
Use the Responses API for GPT models that support/v1/responses.
Do not test Claude models through the Responses API. Use
/v1/messages or OpenAI-compatible /v1/chat/completions for Claude.Images, Audio, And Transcription
OpenAI-compatible image and audio routes use the same SDK client.Native Async Task Routes
Video, Kling, Luma, Suno, Midjourney, and similar async tasks are usually not OpenAI SDK methods. Call Crazyrouter native HTTP paths with the same API key.Upload A Local Image
For image-to-video, vision, and image-editing inputs, upload local reference images first.Complete SDK Smoke Test
Save this ascrazyrouter-sdk-smoke.mjs:
models.listreturns the available model countchat.completions.createreturns textchat.completions.streamreceives streamed textembeddings.createreturns an embedding vector/v1/video/queryreturns a task-not-found or other business status, which confirms the native async query route exists