Skip to main content
Piramyd is a drop-in replacement for the OpenAI SDK — point your existing client at https://api.piramyd.cloud/v1 and you’re routing requests through the gateway immediately. This guide walks you from account creation to your first streaming chat completion in four steps.
1

Create an account and copy your API key

Go to dash.piramyd.cloud and complete the onboarding flow. Once inside the dashboard, navigate to API Keys and create a new key. Copy it now — you won’t be able to see the full value again after leaving that screen.Store your key in an environment variable rather than hardcoding it in source code:
2

Discover available models

Never hardcode a model ID. The catalog changes as new models are added, and each model exposes metadata — like supports_tools, supports_vision, context_length, and which endpoints it works with — that you should read at runtime to make safe decisions.
cURL
Each model object in the response includes the fields you need to pick the right model for your use case:
Response shape
In your code, filter the list programmatically to find a model that matches what you need:
3

Send your first chat completion

Piramyd works as a drop-in replacement for the OpenAI SDK. Set base_url (Python) or baseURL (JavaScript) to https://api.piramyd.cloud/v1 and use the model_id you discovered in the previous step.
Pass a thread_id in your request to enable automatic context compaction for multi-turn conversations. The API will transparently summarize earlier messages when a conversation grows beyond the model’s context window — no extra code required on your end.
4

Try streaming

Enable streaming by setting stream=True (Python) or stream: true (JavaScript). Include stream_options: { include_usage: true } to receive token counts in the final chunk — useful for tracking consumption.
Piramyd streams using Server-Sent Events (SSE). Each data: line is a JSON chunk with a delta.content fragment. The stream terminates with data: [DONE].

Next Steps

Authentication

Learn about API keys, JWTs, request tracing, and error codes.

Tool Calling

Define functions, handle tool call responses, and submit results.

Streaming

Deep dive into SSE streaming, including tool call streaming and error handling.