For developers

Build with BharatCode

Every BharatCode account can use a developer API key for personal GenAI apps, prototypes, campus tools, and hackathon projects. The endpoint is OpenAI-compatible and uses BharatCode serving capacity.

Get your key

Sign in, open Account, reveal your developer API key, and copy it into your local environment. Keep it out of git and client-side browser code.

Open account

Call the model route

Point OpenAI-compatible SDKs to https://bharatcode.ai/api/model/v1 and pass your key as a bearer token. The same key works for chat, vision, embeddings, STT, TTS, and image generation.

$ export BHARATCODE_API_KEY=bc_live_your_key_here
$ curl https://bharatcode.ai/api/model/v1/chat/completions -H "Authorization: Bearer $BHARATCODE_API_KEY" -H "Content-Type: application/json" -d '{"model":"bharatcode:qwen36-35b-q6-256k-vision","messages":[{"role":"user","content":"Say hello from BharatCode"}]}'
$ curl https://bharatcode.ai/api/model/v1/embeddings -H "Authorization: Bearer $BHARATCODE_API_KEY" -H "Content-Type: application/json" -d '{"model":"bharatcode:embed-small-v1","input":"student project search query"}'
$ curl https://bharatcode.ai/api/model/v1/audio/transcriptions -H "Authorization: Bearer $BHARATCODE_API_KEY" -F model=whisper-large-v3-turbo -F file=@sample.wav
$ curl https://bharatcode.ai/api/model/v1/audio/speech -H "Authorization: Bearer $BHARATCODE_API_KEY" -H "Content-Type: application/json" -d '{"model":"kokoro-82m","input":"Namaste from BharatCode","voice":"af_heart","response_format":"mp3"}' --output speech.mp3
$ curl https://bharatcode.ai/api/model/v1/images/generations -H "Authorization: Bearer $BHARATCODE_API_KEY" -H "Content-Type: application/json" -d '{"model":"flux-1-schnell","prompt":"a BharatCode student hackathon poster","size":"1024x1024","response_format":"url"}'

Use an SDK

For backend apps, use the official OpenAI SDK with BharatCode as the base URL. Keep the key in an environment variable.

$ import OpenAI from 'openai'
$ 
$ const client = new OpenAI({
$   apiKey: process.env.BHARATCODE_API_KEY,
$   baseURL: 'https://bharatcode.ai/api/model/v1',
$ })
$ 
$ const completion = await client.chat.completions.create({
$   model: 'bharatcode:qwen36-35b-q6-256k-vision',
$   messages: [{ role: 'user', content: 'Build a study planner schema' }],
$ })
$ 
$ const embedding = await client.embeddings.create({
$   model: 'bharatcode:embed-small-v1',
$   input: 'student project search query',
$ })

Tell your agent

Copy these instructions into your coding agent so it can wire BharatCode into your app without searching the docs.

- Use BharatCode as an OpenAI-compatible model endpoint.
- Get the user's developer API key from https://bharatcode.ai/account.
- Set baseURL to https://bharatcode.ai/api/model/v1.
- Send Authorization: Bearer <BHARATCODE_API_KEY>.
- Use bharatcode:qwen36-35b-q6-256k-vision for chat and image-aware coding tasks.
- Use bharatcode:embed-small-v1 at /embeddings for text embeddings.
- Use whisper-large-v3-turbo at /audio/transcriptions for speech-to-text.
- Use kokoro-82m at /audio/speech for text-to-speech.
- Use flux-1-schnell at /images/generations for image generation.
- Keep keys on the server side. Do not ship them in browser bundles or mobile apps.

Available services

Chat and vision

Use bharatcode:qwen36-35b-q6-256k-vision on /chat/completions for coding, tool use, reasoning, and image-aware prompts.

Embeddings

Use bharatcode:embed-small-v1 on /embeddings for semantic search, retrieval, and project matching features.

Speech to text

Use whisper-large-v3-turbo on /audio/transcriptions for uploaded audio files.

Speech and images

Use kokoro-82m on /audio/speech and flux-1-schnell on /images/generations as they become available.

Use shared compute carefully

BharatCode API keys use the same shared resource as the website, CLI, Desktop, and VS Code. Keep requests purposeful, avoid background loops, and treat the key like a password.