Copied to clipboard
Skip to content

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:

bash
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.

LanguageFrameworks
curlno setup: curl and jq are enough
PythonFastAPI, Django, Flask
JavaScript / TypeScriptExpress, Next.js, ws for WebSocket bridges
PHPLaravel (controller, streamed response, queued job)
Rustreqwest with tokio and futures
Gostandard 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.

bash
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." }]
  }'
python
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)
ts
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
<?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
<?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'];
rust
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"]);
go
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 ​

FieldMeaning
idUnique request id, also returned as the x-request-id header
modelThe catalogue id that actually served the request
usageToken counts used for metering
choicesOne entry per completion, with message and finish_reason

Next steps ​

ORVYX is a proprietary AI platform. All rights reserved.