Developer guide
Move your application to Exchange
Keep your OpenAI or Anthropic client. Start with a model call, check the receipt, then migrate your routing rules.
This guide describes the review implementation. Full OpenRouter routing parity is still in progress; the preview tools below never run a model.
Manage API keys Browse models1. Make your first request
Set OPENVIBE_KEY to your Exchange key locally. Never put it in browser code. Use a new Idempotency-Key for each logical request; reuse it only when retrying the same input.
curl https://api.openvibe.exchange/v1/chat/completions \
-H "Authorization: Bearer $OPENVIBE_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: migration-example-001" \
-d '{"model":"openvibe/auto","messages":[{"role":"user","content":"Hello"}]}'import OpenAI from 'openai';
const ai = new OpenAI({
apiKey: process.env.OPENVIBE_KEY,
baseURL: 'https://api.openvibe.exchange/v1'
});
const answer = await ai.chat.completions.create({
model: 'openvibe/auto',
messages: [{ role: 'user', content: 'Hello' }]
});
console.log(answer.choices[0].message.content);2. Change your gateway settings
| From | Change | Check before rollout |
|---|---|---|
| OpenRouter | Use https://api.openvibe.exchange/v1 and an Exchange key. | Use the catalogue's model ids. Provider routing fields need the C2 execution integration; preview results are not an execution policy. |
| LiteLLM | Configure an OpenAI-compatible provider with Exchange's api_base and key. | Turn off duplicate gateway retry layers; verify timeouts and budget limits in your application. |
| Vercel AI SDK | Configure your OpenAI provider's baseURL and apiKey for Exchange. | Gateway-specific providerOptions are not automatically translated. |
| Portkey | Point the application's OpenAI client directly to Exchange. | Portkey configuration ids and virtual-key headers do not carry across; recreate policies explicitly. |
3. Inspect routing without sending a prompt
Use your Network developer token for the diagnostic routes. They do not hold credits, reveal provider keys or call an upstream. Unknown provider fields are rejected; unknown prices and privacy policies cannot satisfy a hard requirement.
curl https://api.openvibe.exchange/v1/routing/preview \
-H "Authorization: Bearer $OPENVIBE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"openvibe/auto","provider":{"sort":"price","data_collection":"deny","zdr":true,"max_price":{"prompt":1,"completion":2}}}'The response identifies excluded providers and the rule that excluded them. It is catalogue-only: live availability, account gates and budgets still apply. Quality and speed need measured evidence.
4. Validate an exported preset
Send the preset configuration, never an OpenRouter key. This preview validates names, model lists, sampling and provider rules. It returns a validation summary without repeating submitted values and does not save the preset. Save the same definition with POST /v1/presets/import using your person token, then invoke @preset/name.
curl https://api.openvibe.exchange/v1/presets/import/preview \
-H "Authorization: Bearer $OPENVIBE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"writer","model":"openvibe/auto","temperature":0.4,"provider":{"sort":"price"}}'5. Limit the credential
The key provisioning API accepts a name, monthly_cap_usd, allowed_models and optional expires_at in ISO 8601. Expired keys fail authentication, including reservations made with a previously resolved key. Revocation is immediate. Key metadata never returns the secret again.
Inspect the completion's x_openvibe receipt for cost and provider. Existing streaming, tool calls and structured outputs use the corresponding provider's capabilities. Test your exact media and caching inputs before moving traffic.
Compatibility work still under review
See the API reference for routing execution, model fallbacks, suffixes, saved request presets, generation lookup and compatible endpoints. Image generation needs configured non-metered capacity; paid image accounting remains pending. Quality/value routing uses the Bench ratings shown by Report and refuses offers without established evidence. Web grounding and task/choice-driven agent streams remain separate work.
Current API reference