OpenAI-compatible Python examples for developers who want a practical starting point, not just the first hello-world request.
If your app already uses the OpenAI Python SDK, you can often test a new endpoint with only three changes:
- change the API key
- change the base URL
- choose the target model
That makes this repo useful for teams working on:
- OpenAI-compatible migration tests
- rollout validation
- fallback and routing experiments
- cost-aware workload splitting
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
export XIDAO_API_KEY="***"
python examples/chat_completion.pyfrom openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["XIDAO_API_KEY"],
base_url="https://global.xidao.online/v1"
)examples/chat_completion.py— minimal OpenAI-compatible chat completionexamples/embeddings.py— embedding request exampleexamples/cost_aware_summary.py— simple low-value-task cost control example
- streaming example
- retry boundary example
- structured output / JSON validation example
- fallback handoff example
../xidao-cookbook/guides/migrate-from-openai.md../xidao-cookbook/guides/openai-compatible-rollout-checklist.md../xidao-cookbook/guides/llm-failover-routing-patterns.md../xidao-cookbook/guides/vercel-ai-sdk-openai-compatible.md../xidao-cookbook/guides/reduce-api-costs.md
../llm-failover-router-demo../xidao-cookbook
- Website: https://global.xidao.online/
- Support: support@xidao.online
- Telegram: https://t.me/ccyu085