Spro is fully OpenAI-compatible. The Chat Completions API (/v1/chat/completions) and the Responses API (/v1/responses) are supported with their full feature set — streaming, tool calling, structured output, vision, and reasoning.
If your code already uses the OpenAI SDK, integrating Spro takes two changes: point the client at Spro's base URL, and use your Spro API key. Everything else — request shapes, response shapes, streaming behavior, error formats — works exactly as before.
What changes
Only two values:
from openai import OpenAI
client = OpenAI( base_url="https://spro.hridaai.com/v1", # was https://api.openai.com/v1 api_key="YOUR_SPRO_API_KEY", # your Spro key, starts with spro-)import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://spro.hridaai.com/v1", // was https://api.openai.com/v1 apiKey: "YOUR_SPRO_API_KEY", // your Spro key, starts with spro-});The one thing to know: model names. Use provider-prefixed model IDs — gpt-oss-20b, anthropic/claude-sonnet-4, z-ai/glm-5.3-flash — or a plain model name for automatic routing. See Models.
Example: Chat Completions
from openai import OpenAI
client = OpenAI( base_url="https://spro.hridaai.com/v1", api_key="YOUR_SPRO_API_KEY",)
response = client.chat.completions.create( model="gpt-oss-20b", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"}, ],)
print(response.choices[0].message.content)Example: Responses API
The same client works for the newer Responses API — including reasoning models:
response = client.responses.create( model="gpt-oss-20b", input="What is the capital of France?",)
print(response.output_text)Example: Streaming
A complete streaming example — tokens print as they arrive, with usage reported at the end:
from openai import OpenAI
client = OpenAI( base_url="https://spro.hridaai.com/v1", api_key="YOUR_SPRO_API_KEY", max_retries=0,)
response = client.chat.completions.create( model="gpt-oss-20b", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Introduce yourself"}, ], temperature=0.7, stream=True,)
for chunk in response: if chunk.choices: delta = chunk.choices[0].delta if delta.content: print(delta.content, end="", flush=True)
if chunk.usage is not None: print("\nUSAGE:", chunk.usage)Beyond chat
The same client covers the rest of the OpenAI surface:
- Embeddings —
client.embeddings.create(...)for search, RAG, and clustering - Images —
client.images.generate(...)and the JSON-body edits endpoint - Model listing —
client.models.list()for the active gateway models
