For the complete documentation index, see llms.txt. This page is also available as Markdown.

Go SDK

Setup

For Open AI compatible:

go get github.com/openai/openai-go/v3
go get github.com/joho/godotenv

For Anthropic compatible:

"github.com/anthropics/anthropic-sdk-go"
"github.com/anthropics/anthropic-sdk-go/option"
"github.com/joho/godotenv"

All examples read the API key from a .env file. OpenAI SDK clients use the base URL https://api.nexos.ai/v1; the Anthropic SDK appends /v1/messages itself, so it takes the bare https://api.nexos.ai.

API_KEY=YOUR_NEXOS_API_KEY

Model IDs on nexos.ai are the model names shown in the console (e.g. GPT 5.6 Sol, Claude Sonnet 5, Whisper). List them with GET /v1/models.

Chat Completion

Send a conversation and get the model's next reply — the standard OpenAI-compatible endpoint, supported by most chat models on the platform.

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/joho/godotenv"
	"github.com/openai/openai-go/v3"
	"github.com/openai/openai-go/v3/option"
)

func main() {
	err := godotenv.Load()
	if err != nil {
		panic(err)
	}
	apiKey := os.Getenv("API_KEY")
	client := openai.NewClient(
		option.WithBaseURL("https://api.nexos.ai/v1"),
		option.WithAPIKey(apiKey),
	)
	response, err := client.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{
		Model: "GPT 5.6 Sol",
		Messages: []openai.ChatCompletionMessageParamUnion{
			openai.UserMessage("how many letters 'r' in the word 'strawberry'"),
		},
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(response.Choices[0].Message.Content)
}

Messages

The /v1/messages endpoint implements the Anthropic Messages API and works with the official Anthropic SDK (go get github.com/anthropics/anthropic-sdk-go). It is available for models that list the messages endpoint in GET /v1/models (e.g. Claude models).

Messages - prompt caching

Reuse a large, stable prompt prefix across calls to cut cost (cached tokens are ~10× cheaper) and latency. /v1/messages forwards cache_control byte-for-byte, so Anthropic prompt caching works natively. The cached prefix must exceed the model's minimum cacheable length (~1024 tokens):

Messages streaming

Receive the reply incrementally as server-sent events instead of waiting for the whole message — useful for chat UIs and long outputs.

Messages with thinking

Let the model reason internally before answering — the response starts with a thinking block followed by the final text.

Messages with tool calls

Let the model call functions you define: it responds with a tool_use block, your code runs the tool and sends the result back, and the model produces the final answer.

Responses

OpenAI's newer generation API: send text or structured input items and get the model output back.

Responses - compact conversation

Compress a long stored conversation into a smaller context so it can keep going without hitting the model's context limit. Pass the last response's ID via previous_response_id — the API returns a new, compacted response whose ID you use to continue the conversation.

Responses lifecycle

Stored responses (store=true) live on the platform after creation, so you can work with them later: retrieve a response by ID, list the input items it was created from, and delete it when it's no longer needed.

Embeddings

Convert text into a numeric vector for semantic search, clustering, and RAG. One vector is returned per input.

Audio Generation

Convert text to spoken audio (text-to-speech).

Audio Transcription

Transcribe an audio file to text in its original language.

Audio Translation

Transcribe an audio file and translate the text into English.

Image Generation

Generate an image from a text prompt.

Last updated