GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - XidaoApi/xidao-python-examples: OpenAI-compatible Python SDK examples — chat completions, embeddings, streaming, retries, and multi-provider base_url switching. Works with XiDao, OpenRouter, Together, and any OpenAI-compatible API.

BranchesTags
Open more actions menu

Latest commit

 

History

5 Commits
5 Commits

Folders and files

NameName
Last commit message
Last commit date
examples
examples
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

XiDao Python Examples

License: MIT GitHub release GitHub stars

OpenAI-compatible Python examples for developers who want a practical starting point, not just the first hello-world request.

Why this repo exists

If your app already uses the OpenAI Python SDK, you can often test a new endpoint with only three changes:

  1. change the API key
  2. change the base URL
  3. 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

Quickstart

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
export XIDAO_API_KEY="***"
python examples/chat_completion.py

Base configuration

from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["XIDAO_API_KEY"],
    base_url="https://global.xidao.online/v1"
)

Included examples

  • examples/chat_completion.py — minimal OpenAI-compatible chat completion
  • examples/embeddings.py — embedding request example
  • examples/cost_aware_summary.py — simple low-value-task cost control example

Production-minded extensions to add next

  • streaming example
  • retry boundary example
  • structured output / JSON validation example
  • fallback handoff example

Related guides

  • ../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

Related repos

  • ../llm-failover-router-demo
  • ../xidao-cookbook

Links

  • Website: https://global.xidao.online/
  • Support: [email protected]
  • Telegram: https://t.me/ccyu085

About

OpenAI-compatible Python SDK examples — chat completions, embeddings, streaming, retries, and multi-provider base_url switching. Works with XiDao, OpenRouter, Together, and any OpenAI-compatible API.

xidaoapi.com

Topics

2026agentic-aiaiai-apiai-gatewayapi-migrationbase-urlchat-completionclaudeembeddingsllmmulti-provideropenaiopenai-compatibleopenrouterpythonretriessdkstreamingstructured-output

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.