PACINFRAX · RESOURCES

One text contract. Two server-side clients.

Use the local gateway through TypeScript or Python, with explicit project credentials and bounded responses.

Local mock only. Neither SDK is published, full OpenAI compatibility or evidence of live GPU capacity. Start and configure the synthetic gateway on4100 separately; no public API is available.

TypeScript · Node ESM

Server-only package; browser export conditions are rejected. Set PAX_PROJECT_API_KEY securely in the server environment, never in a public browser variable.

npm run build --workspace @pacinfrax/sdk
node --input-type=module

// In that Node session, with the gateway and test key configured:
const { PacinfraXClient, projectKeyFromEnvironment } = await import('@pacinfrax/sdk');
const client = new PacinfraXClient({ resolveProjectKey: projectKeyFromEnvironment() });
const models = await client.listModels();
const response = await client.complete({
  model: models.data[0].id,
  messages: [{ role: 'user', content: 'Hello synthetic world' }],
  max_completion_tokens: 32,
});
console.log(response.choices[0].message.content);

Python · async client

Python3.12+ and pinned HTTPX. Use the same project-key environment variable; explicit iterator close releases cooperative transports when you stop consuming.

# Install from this repository, not a published package:
python -m pip install ./clients/python

# Save the following in a Python script and run it:
import asyncio
from contextlib import aclosing
from pacinfrax import PacinfraXClient, project_key_from_environment

async def main():
    client = PacinfraXClient(project_key_from_environment())
    models = await client.list_models()
    request = {
        'model': models['data'][0]['id'],
        'messages': [{'role': 'user', 'content': 'Hello synthetic world'}],
        'max_completion_tokens': 32,
    }
    async with aclosing(client.stream(request)) as events:
        async for event in events:
            if event['type'] == 'delta':
                print(event['content'], end='', flush=True)
            else:
                print('Reported synthetic usage:', event['usage'])

asyncio.run(main())

Failure is not a retry instruction

Neither client retries inference POSTs automatically. A timeout or disconnect may occur after execution or usage. Use sanitized request IDs for diagnosis, not provider error bodies or credential-bearing tracebacks.

Streaming emits done only after terminal usage, DONE and clean EOF. Partial text is not a successful receipt. Python deadlines require cooperative async work; synchronous resolvers and cleanup are not hard real-time guarantees. Close or exhaust iterators; cancellation does not prove GPU or accounting cancellation.

Current support is text messages, token limits, temperature and seed. Tools, images and arbitrary OpenAI parameters are unsupported. Reported usage is synthetic and approximate, not an invoice.

Review exact local request limits →