einocodex

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 17 Imported by: 0

README

einocodex

Adapter for eino's openai ResponsesModel. This allows you to utilise your codex subscription instead of using a openai api key.

In other words this allows you to test your eino agents locally using codex subscription.

Quickstart

Prerequisites:

  1. Go v1.27
  2. Logged in to codex at least once
  3. Optional: set CODEX_HOME

Install with:

go get github.com/brandonyeoxg/einocodex
model, err := einocodex.NewModel(context.Background(), &einocodex.ResponsesConfig{
    Model: "OPENAI_SUPPORT_MODEL_ID",
})
if err != nil {
    ...
}

userMsg := schema.UserAgenticMessage("Say hello world in one sentence.")
stream, err := model.Stream(context.Background(), []*schema.AgenticMessage{
    userMsg,
})
if err != nil {
    ...
}
defer stream.Close()

for {
    d, err := stream.Recv()
    if errors.Is(err, io.EOF) {
        break
    }
    ...
}

Examples

There are examples that you can reference and run:

  1. stream - main.go
  2. generate - main.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResponsesConfig

type ResponsesConfig struct {
	Model string
}

type ResponsesModel

type ResponsesModel struct {
	*agenticopenai.ResponsesModel
}

func NewModel

func NewModel(ctx context.Context, conf *ResponsesConfig) (*ResponsesModel, error)

NewModel creates a codex subscription compliant responses model.

func (*ResponsesModel) Generate

func (rm *ResponsesModel) Generate(ctx context.Context, input []*schema.AgenticMessage, opts ...model.Option) (*schema.AgenticMessage, error)

Generate overrides the original due to how the codex endpoint only allows for streaming requests and does not support generate. This buffers the stream and returns the chunks as a single message.

Directories

Path Synopsis
examples
generate command
stream command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL