Skip to main content

Quickstart

Pick a model backend, how to run the server, and what to build. The steps below update to match.

Backend
Server
Use case
  1. Pull the models

    Install Ollama, then pull a chat model and an embedding model. The embedding model powers the Responses API, vector stores, and file search.

    ollama pull llama3.2:3b
    ollama pull nomic-embed-text
  2. Start the server

    With uv installed, start the server. ogx go finds the running backends, installs what they need, and starts serving.

    uvx ogx go

    The server listens on https with a self-signed certificate and requires an API key. It prints three generated keys when it starts, and they change every time it restarts:

    ✓ Simple authentication enabled
    Here are keys you can use for authentication:
    ogk_...
  3. Point your tools at the server

    In the terminal where you run the examples, tell clients where the server is. The Python examples and ogx connect both read these variables.

    export OGX_BASE_URL=https://localhost:8321/v1
    export OGX_API_KEY=ogk_... # one of the keys ogx go printed
  4. Check that it works

    List the models the server registered. You should see ollama/llama3.2:3b among them.

    curl -k -s -H "Authorization: Bearer $OGX_API_KEY" $OGX_BASE_URL/models
  5. Call it with the OpenAI SDK

    Point the OpenAI SDK you already use at OGX:

    app.py
    import os

    from openai import DefaultHttpxClient, OpenAI

    client = OpenAI(
    base_url=os.environ["OGX_BASE_URL"],
    # Servers started with --no-auth accept any key
    api_key=os.environ.get("OGX_API_KEY", "unused"),
    # ogx go serves a self-signed certificate, so skip verification for local use
    http_client=DefaultHttpxClient(verify=False),
    )

    response = client.responses.create(
    model="ollama/llama3.2:3b",
    input="In one sentence, what is an API server?",
    )
    print(response.output_text)
    pip install openai
    python app.py
Project setup

uvx is great for trying things out. For a real project, install into a persistent environment:

uv init my-ai-app && cd my-ai-app
uv add ogx openai
uv run ogx go

Troubleshooting​

Port already in use

If you see Address already in use, another process is using port 8321. Either stop it or run on a different port, and use that port in OGX_BASE_URL:

uvx ogx go --port 8322
Connection refused or connection error

If curl returns Connection refused, the server has not finished starting. Wait a few seconds for model registration to complete, then try again. Check the terminal where you started the server for errors.

If the Python client raises APIConnectionError, check that OGX_BASE_URL starts with https://. ogx go only listens on http when started with --insecure.

Authentication required

If the API returns Authentication required, the request is missing a valid API key. Export one of the keys printed by the running ogx go:

export OGX_API_KEY=ogk_...

Keys from an earlier run stop working when the server restarts.

Responses API returns Not Found

If client.responses.create fails with Not Found, look for this line in the ogx go output:

✗ No embedding model detected — vector stores, file-search, and responses disabled.

Pull an embedding model and restart the server:

ollama pull nomic-embed-text
uvx ogx go

To use a different embedding model, pass --default-embedding-model PROVIDER_ID/MODEL_ID --default-embedding-dimension DIMENSION.

Model not found

If the API returns an error about a model not being found, make sure you pulled the model first. For Ollama:

ollama pull llama3.2:3b

Then restart the OGX server, and check which models it registered:

curl -k -s -H "Authorization: Bearer $OGX_API_KEY" $OGX_BASE_URL/models
Coding agent replies are empty

Ollama's default context window is smaller than a coding agent's prompt, so the model only sees part of it. Restart Ollama with a larger window:

OLLAMA_CONTEXT_LENGTH=16384 ollama serve

What's next?​