Examples
Working, copy-paste recipes for the ORVYX API. Every snippet runs against the same base URL and the same key, so you can move between them freely.
Before you start
You need an ORVYX API key (oryx_...). Create one in the dashboard under API Keys, then export it:
export ORVYX_API_KEY="oryx_..."Pick a recipe
Frameworks covered
Every recipe ships with a Frameworks section, so you can copy the wiring for the stack you already run instead of translating from scratch.
| Language | Frameworks |
|---|---|
| curl | no setup: curl and jq are enough |
| Python | FastAPI, Django, Flask |
| JavaScript / TypeScript | Express, Next.js, ws for WebSocket bridges |
| PHP | Laravel (controller, streamed response, queued job) |
| Rust | reqwest with tokio and futures |
| Go | standard library, Gin |
Transports are covered too: every streaming recipe that needs one shows the SSE, WebSocket or polling shape, and says which trade-off you are accepting.
A minimal request
Every example below is a variation on this shape: point an OpenAI-compatible client at ORVYX, pick a model by id, send messages.
curl https://api.orvyx-ai.com/v1/chat/completions \
-H "Authorization: Bearer $ORVYX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "orvyx/deepseek-v4-pro-0813",
"messages": [{ "role": "user", "content": "Hello from ORVYX." }]
}'from openai import OpenAI
client = OpenAI(
base_url="https://api.orvyx-ai.com/v1",
api_key="oryx_...",
)
completion = client.chat.completions.create(
model="orvyx/deepseek-v4-pro-0813",
messages=[{"role": "user", "content": "Hello from ORVYX."}],
)
print(completion.choices[0].message.content)import OpenAI from "openai"
const client = new OpenAI({
baseURL: "https://api.orvyx-ai.com/v1",
apiKey: process.env.ORVYX_API_KEY,
})
const completion = await client.chat.completions.create({
model: "orvyx/deepseek-v4-pro-0813",
messages: [{ role: "user", content: "Hello from ORVYX." }],
})
console.log(completion.choices[0].message.content)<?php
$ch = curl_init('https://api.orvyx-ai.com/v1/chat/completions');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ORVYX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'model' => 'orvyx/deepseek-v4-pro-0813',
'messages' => [['role' => 'user', 'content' => 'Hello from ORVYX.']],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $res['choices'][0]['message']['content'];<?php
use Illuminate\Support\Facades\Http;
$res = Http::withToken(config('services.orvyx.key'))
->post('https://api.orvyx-ai.com/v1/chat/completions', [
'model' => 'orvyx/deepseek-v4-pro-0813',
'messages' => [['role' => 'user', 'content' => 'Hello from ORVYX.']],
])
->throw()
->json();
echo $res['choices'][0]['message']['content'];use reqwest::Client;
use serde_json::json;
let client = Client::new();
let res = client
.post("https://api.orvyx-ai.com/v1/chat/completions")
.bearer_auth(std::env::var("ORVYX_API_KEY").unwrap())
.json(&json!({
"model": "orvyx/deepseek-v4-pro-0813",
"messages": [{ "role": "user", "content": "Hello from ORVYX." }]
}))
.send()
.await?
.json::<serde_json::Value>()
.await?;
println!("{}", res["choices"][0]["message"]["content"]);package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]any{
"model": "orvyx/deepseek-v4-pro-0813",
"messages": []map[string]string{
{"role": "user", "content": "Hello from ORVYX."},
},
})
req, _ := http.NewRequest("POST", "https://api.orvyx-ai.com/v1/chat/completions", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("ORVYX_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
var out struct {
Choices []struct {
Message struct {
Content string `json:"content"`
} `json:"message"`
} `json:"choices"`
}
json.NewDecoder(res.Body).Decode(&out)
fmt.Println(out.Choices[0].Message.Content)
}Each snippet above has Copy, ChatGPT and Claude buttons in the top-right corner: copy it straight into your project, or open it in a chat to ask follow-up questions.
What every response shares
| Field | Meaning |
|---|---|
id | Unique request id, also returned as the x-request-id header |
model | The catalogue id that actually served the request |
usage | Token counts used for metering |
choices | One entry per completion, with message and finish_reason |
Next steps
- API Reference for every parameter and status code.
- Error Handling for the error envelope and retries.
- Rate Limits to pace your requests before throttling.
